原文:https://blog.csdn.net/michael_ouyang/article/details/54923052
簡單修改2個自動生成的模板文件即可。
1、修改index.wxml:
增加:
<button bindtap='changeMotto'>點擊</button>
2、修改index.js,增加一個函數:
changeMotto: function() {
this.setData({
motto: "你好,世界"
})
},
這樣就可以了: