1.官方文档
http://mpvue.com/mpvue/quickstart/
2.其他资料
https://www.v2ex.com/amp/t/447109
http://www.bslxx.com/m/view.php?aid=1824
3.问题笔记
一.wx.request请求时候this取不到值
- data () {
- return {
- questionlist: []
- }
- },
- methods: {
- getData () {
- var that = this //这个地方非常重要,重置data{}里数据时候setData方法的this应为以及函数的this, 如果在下方的sucess直接写this就变成了wx.request()的this了
- wx.request({
- url: 'getData.php',
- data: {},
- header: {
- 'content-type': 'application/json'
- },
- success: function (res) {
- that.questionlist = res.data
- }
- })
- }
- },
- created () {
- // 页面加载时调用
- this.getData()
- }