微信小程序获取data:{}变量时报错xxx is not defined
在data:{}声明初始化了一个变量,在onLoad:function()函数调用时,出现“xxx is not defined”错误,原因是直接使用了变量名,没有使用获取页面data对象的this.data 会报错的原代码: Page({ data: { text:'Welcome' }, onLoad: function(options){ console.log(text); }, }) 正确写法 Page({ data: { text: 'Welcome' }, onLoad: function...