网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

小程序模板網

小程序組件化封裝引導

發布時間:2017-12-05 08:58 所屬欄目:小程序開發教程

案例:微信小程序-自定義組件 相關代碼:微信小程序自定義組件源碼 組件化的剖析過程: 注意: 1. 基礎知識:ES6 class, 參考:class 2. Object.assign() 等Object的方法,參考Object.assign() 具體的組件化方案 ...

 
 
 

案例:微信小程序-自定義組件 
相關代碼:微信小程序自定義組件源碼 
組件化的剖析過程: 
組件化.png 
注意: 
1. 基礎知識:ES6 class, 參考:class 
2. Object.assign() 等Object的方法,參考Object.assign()

具體的組件化方案參考:寫一個微信小程序自定義公共組件

注意的是:

template 使用展開的數據是 data="{{ ...obj }}"

 

		
  1. <template is="box" data="{{...obj}}"/>

page.data上沒有定義 obj ,  在template 內使用wx:for循環輸出列表會報錯,就算在onLoad事件上setData也是有誤的。

VM18377:2 firstRender not the data from Page.data  firstRender not the data from Page.data;firstRender not the data from Page.dataError: firstRender not the data from Page.data

所以最好在data中加入一個空的obj: {}.  如果不需要用到wx:for的可以忽略。



易優小程序(企業版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://www.xiuhaier.com/wxmini/doc/course/18032.html 復制鏈接 如需定制請聯系易優客服咨詢:800182392 點擊咨詢
QQ在線咨詢
AI智能客服 ×