1、微信小程序,mpVue和wepy的對比

2、

3、es6中關於數組的一些方法
1 <script> 2 let arr = [1,2,3,4] 3 // 遍歷 4 arr.forEach(v => { 5 console.log(v) 6 }) 7 // 循環操作 8 console.log(arr.map(v => v*2)) 9 // 循環判斷 10 console.log(arr.every(v => v > 2)) 11 // 過濾 12 console.log(arr.filter(v => v <= 3)) 13 // 數組去重 14 let arr1 = [1,2,3,4,5,2] 15 let arr2 = [4,5,6,7] 16 console.log([...new Set(arr1)]) 17 // 並集 18 console.log(arr1.concat(arr2)) 19 // 去重並集 20 console.log([...new Set([...arr1,...arr2])]) 21 </script>

arr.foreach 遍歷
arr.map 按順序進行操作 返回一個數組
arr.every every() 方法測試數組的所有元素是否都通過了指定函數的測試。 https://www.cnblogs.com/leejersey/p/5483247.html
4、小程序生命周期
https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/app.html
5、初始化一個mpvue項目
http://mpvue.com/mpvue/quickstart/
1 # 3. 全局安裝 vue-cli 2 # 一般是要 sudo 權限的 3 $ npm install --global vue-cli 4 5 # 4. 創建一個基於 mpvue-quickstart 模板的新項目 6 # 新手一路回車選擇默認就可以了 7 $ vue init mpvue/mpvue-quickstart my-project 8 9 # 5. 安裝依賴,走你 10 $ cd my-project 11 $ npm install 12 $ npm run dev
npm run dev啟動項目后 用微信小程序開發工具打開項目 就可以自動運行
6、mpvue項目結構

7、mpVue中的生命周期

主要是用Vue的生命周期,Created創建初始化。Vue沒有的生命周期,就用小程序自己的


8、koa的一些知識

ctx是什么?
是封裝了request和response的上下文
next是什么?
下一個中間件
app是什么?
啟動應用
koa中的中間件

類似洋蔥一樣的圓環,從中間件1,2,3進入,再從3,2,1出來,得到最后的響應結果,因為是圓環狀的,所以可以得到網絡請求之前或之后的內容

結果是:135642
9、回調地獄,Promise,async+await
1 function ajax(fn) { 2 setTimeout(() => { 3 console.log('你好') 4 fn() 5 }, 1000) 6 } 7 // 回調地獄 8 ajax(()=>{ 9 console.log('執行結束') 10 ajax(()=>{ 11 ajax(()=>{ 12 ajax(()=>{ 13 console.log('執行結束3') 14 }) 15 }) 16 console.log('執行結束2') 17 }) 18 }) 19 20 // 你好 21 // 執行結束 22 // 你好 23 // 執行結束2 24 // 你好 25 // 你好 26 // 執行結束3 27 28 29 function delay(word) { 30 return new Promise((resolve, reject) => { 31 setTimeout(() => { 32 resolve(word) 33 }, 2000) 34 }) 35 } 36 37 // 使用Promise 38 delay('孫悟空') 39 .then((word) => { 40 console.log(word) 41 return delay('豬八戒') 42 }) 43 .then((word) => { 44 console.log(word) 45 return delay('沙僧') 46 }) 47 .then((word) => { 48 console.log(word) 49 }) 50 51 // saync+await一起使用 52 async function start() { 53 const word1 = await delay('孫悟空') 54 console.log(word1) 55 const word2 = await delay('豬八戒') 56 console.log(word2) 57 const word3 = await delay('沙僧') 58 console.log(word3) 59 } 60 start() 61 62 // 孫悟空 63 // 豬八戒 64 // 沙僧
第一個就是回調地獄,外層的請求結果是內層的參數, 代碼可讀性差,錯誤不易處理
Promise就是用來處理異步請求的
async+await 是Promise的語法糖
為什么使用async+await
https://cnodejs.org/topic/58e4914e43ee7e7106c13541
10、






11、
騰訊雲常見問題:https://cloud.tencent.com/document/product/619/11442
https://coding.imooc.com/lesson/218.html#mid=14305
秘鑰:https://console.cloud.tencent.com/cam/capi
APPid:https://console.cloud.tencent.com/developer
12、微信小程序 請求的url如果報下面的錯

解決辦法是,在微信小程序工具中,點擊詳情,選中下面的

13、eslint: await is a reserved word的解決辦法

解決辦法:

14、微信小程序后台
https://developers.weixin.qq.com/miniprogram/dev/qcloud/qcloud.html#通過微信公眾平台授權登錄騰訊雲

微信公眾平台
https://mp.weixin.qq.com/wxopen/initprofile?action=home&lang=zh_CN&token=1777431014
騰訊雲
https://mp.weixin.qq.com/wxopen/thirdtools?action=index&token=1777431014&lang=zh_CN

騰訊雲后台管理
https://console.qcloud.com/lav2/dev
這里面有關於騰訊雲的各種API

騰訊雲服務端SDK API wafer2-node-sdk
Wafer 服務端 SDK 是騰訊雲為微信小程序開發者提供的快速開發庫
https://github.com/tencentyun/wafer2-node-sdk/blob/master/README.md
騰訊雲相關文檔
https://developers.weixin.qq.com/miniprogram/dev/qcloud/qcloud.html#其他具體開發文檔

15、Mpvue課程問答區總結帖
http://www.imooc.com/article/31092
16、獲取到用戶信息后,用戶信息是如何存入mysql數據庫 的
https://coding.imooc.com/learn/questiondetail/60293.html
17、微信小程序要實現下拉刷新,需要在json里面配置enablePullDownRefresh
https://developers.weixin.qq.com/miniprogram/dev/framework/config.html

下拉刷新的時候會觸發onPullDownRefresh事件
https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/page.html


在mpvue中,要配置的話,在main.js里面

export default { config: { enablePullDownRefresh: true } }

18、8-7 圖書訪問次數統計
mpveu中獲取傳遞的options http://mpvue.com/mpvue/#_18
1. 如何獲取小程序在 page onLoad 時候傳遞的 options
在所有 頁面 的組件內可以通過 this.$root.$mp.query 進行獲取。
19、9-5 手機型號
獲取手機的信息 https://developers.weixin.qq.com/miniprogram/dev/api/systeminfo.html

20. 9-10 (分享功能,使用了button)
button組件 https://developers.weixin.qq.com/miniprogram/dev/component/button.html

