鍍金池/ 問答
久礙你 回答

clipboard.png

所以修改矩陣如下:
mirrorMatrix.set(
    3, 0, 0, 20, 0, 3, 0, 4, 0, 0, 3, 2, 0, 0, 0, 1
);

Update1:

clipboard.png
因為使用數組來存儲矩陣,矩陣是二維的,如果用一維數組存儲的話,肯定會涉及一個順序問題,即一行行的存儲還是一列列的存儲;
官網的說明是set方法使用的是行主序,元素中的矩陣是列主序,舉例如下:
矩陣

3 0 0 20
0 3 0 4
0 0 3 2
0 0 0 1

clipboard.png

如果使用行主序存儲在數組中,那么這個數組是[3, 0, 0, 20, 0, 3, 0, 4, 0, 0, 3, 2, 0, 0, 0, 1]

clipboard.png

如果使用列主序存儲在數組中,那么這個數組是[3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 20, 4, 2, 1]

檸檬藍 回答

下載一個解壓版的吧,我的一直安裝不成功,下載解壓版本的就好了

苦妄 回答

User.findOne()的內容能發(fā)一下嗎?User.findOne()是不是返回Promise?你這樣寫試試:

user.post('/register', async(ctx) => {
let {username, password, rePassword} = ctx.request.body;

if (!username) {
    responseClient(ctx, 400, 2, '用戶名不可為空');
    return;
}
if (!password) {
    responseClient(ctx, 400, 2, '密碼不可為空');
    return;
}
if (password !== rePassword) {
    responseClient(ctx, 400, 2, '兩次密碼不一致');
    return;
}   

try{
   User.findOne({username}).then(function(doc,err){
        if(err){
             responseClient(ctx);
         }

         if(doc){
             responseClient(ctx, 200, 1, '用戶名已存在');
             return;  
         }else{
             //保存到數據庫
            let user = new User({
                 username: username,
                 password: password,
                 type: 'user'
             });

             user.save(function(err, doc){
                 if(err){
                     console.log(err);
                 }
                 if(doc){
                     let data = {};
                     data.username = doc.username;
                     data.userType = doc.type;
                     data.userId = doc._id;
                     responseClient(ctx, 200, 0, '注冊成功', data);
                     return;
                 }
             });   
         }
     })

       }

}catch(e){
    responseClient(ctx);
}

})

臭榴蓮 回答

前端木有安全

陪我終 回答

pip沒有安裝吧
如果是ubuntudebian的話sudo apt-get install python-pip

默念 回答

前后請求是否對返回的數據有依賴

兔寶寶 回答

添加一個loading狀態(tài),滾動到底部時loading = true并開始加載,加載結束(成功或失?。┖髄oading=false,
加載分頁數據的方法中需要確保不在loading狀態(tài)否則不加載,怕方法調用頻繁可以加個debounce。

枕頭人 回答
  1. 全局安裝nrm: npm install nrm -g;
  2. 查看鏡像源: nrm ls;
  3. 切換鏡像源: nrm use taobao; // 我用的淘寶
  4. 安裝需要的模塊: npm install <package-name>;
  5. 如果需要安裝全部依賴: npm install;

// 有問題再call我

傲寒 回答

你把這段刪掉

# sitemap:
# path: sitmap.xml
# baidusitemap:
# path: baidusitemap.xml

應該是不用加也就可以生成的了。
前提是你的# URL 是配置對了的。

大濕胸 回答

<span :class="{active:priceIndex[index]===index}"></span>

孤客 回答

dev-server的地址是localhost:7777,API地址是localhost:3306,你請求的時候請求localhost:7777/api/newStu/searchNewStu應該就好了

毀憶 回答

this.data.num1 是字符串吧?檢查下

扯機薄 回答

400錯誤,你的請求不對,接口寫的沒問題的話,那就是參數傳的不對了。
axios的post參數提交是這樣寫的:

axios.post('query', {C: code, Q: arg}).then().catch()

get提交參數則又是這樣的:

axios.get('query', {params: {C: code, Q: arg}}).then().catch()
眼雜 回答

https://github.com/ElemeFE/el...
最左邊有 License 類型,這個項目是 MIT

參考 https://baike.baidu.com/item/...

  • 被授權人有權利使用、復制、修改、合并、出版發(fā)行、散布、再授權及販售軟件及軟件的副本。
  • 被授權人可根據程式的需要修改授權條款為適當的內容。
  • 在軟件和軟件的所有副本中都必須包含版權聲明和許可聲明。
  • 此授權條款并非屬copyleft的自由軟件授權條款,允許在自由/開放源碼軟件或非自由軟件(proprietary software)所使用。

阮一峰 的 blog 里有個一圖流,可以看
http://www.ruanyifeng.com/blo...

解夏 回答

index做key會存在這個問題,當你刪除再添加的時候,就會出現(xiàn)key重復的情況

心夠野 回答

顏色可以根據需要自己調整一下

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    div {
      width: 300px;
      height: 300px;
      border: 2px solid #000;
    }
  </style>
</head>

<body oncontextmenu="return false">
  <div id='div' onmousedown='divClick(event)'></div>

  <script>
    var bgColor = ['00', '11', '22', '33', '44', '55', '66', '77', '88', '99', 'aa', 'bb', 'cc', 'dd', 'ee', 'ff'];
    var div = document.getElementById('div');

    function changeBg(index) {
      div.setAttribute('style', 'background-color: #' + bgColor[index] + '0000')
      div.setAttribute('data-index', index)
    }
    changeBg(0);

    function divClick(event) {
      var mouse = event.button
      var index = div.getAttribute('data-index')
      if(index == 0 && mouse == 0){
        index++
      }else if(index == (bgColor.length - 1) && mouse == 2){
        index--
      }else if (index > 0 && index < (bgColor.length - 1)) {
        if (mouse == 0) {//左鍵
          index++
        } else if (mouse == 2) {//右鍵
          index--
        }
      }
      changeBg(index);
    }
  </script>
</body>

</html>
遲月 回答

你這2個頁面是同一個嘛

綰青絲 回答

n是一個全局變量。

changePic并沒有修改圖片,他只是修改了n

change里面,邏輯是:將圖片的編號替換為n,然后將n修改為下一次的編號。
那么在下一個change執(zhí)行之前呢,changePic提前修改了n的值,導致change將點擊的編號展示了出來。
這個n就是點擊時傳入的。

所以這是一個全局變量的運用問題。changePic沒有改圖片,只是改了一個變量,這個變量用于描述下一張圖片的編號。

點擊也沒有立即換圖,換圖還是等到了Interval的兩秒到了,才通過change換圖

冷溫柔 回答

mysql安裝過程有個交互式操作讓你輸入root密碼的,如果你沒有輸入的話(可能是關閉了apt的交互式選項,跳過了交互式操作),那么應該是空的。

另外我記得ubuntu 18.04默認的mysql是5.7,我記得mysql 5.7應該是自動生成一個密碼,你在/var/log/mysqld.log日志文件(不是的話就是在/var/log/mysql/*.log找一下),應該是有打印一個默認密碼的