test.js
Page({
data:{
v1:"v1111",
},
onLoad:function(options){
// 生命周期函数--监听页面加载
console.log("onLoad start...");
this.setDate({
v4:"v4444"
})
console.log("onLoad finish!");
},
test.wxml
<view><text>{{v1}}</text></view>
<view><text>v2</text></view>
<view><text>v3</text></view>
<view><text>{{v4}}</text></view>
-------------------------------
异常信息
thirdScriptError
this.setDate is not a function;at "pages/test/test" page lifeCycleMethod onLoad function
TypeError: this.setDate is not a function
at e.onLoad (http://1633418664.appservice.open.weixin.qq.com/pages/test/test.js:12:10)
at e.<anonymous> (http://1633418664.appservice.open.weixin.qq.com/WAService.js:3:28856)
at w (http://1633418664.appservice.open.weixin.qq.com/WAService.js:3:19253)
at T (http://1633418664.appservice.open.weixin.qq.com/WAService.js:3:20809)
at .<anonymous> (http://1633418664.appservice.open.weixin.qq.com/WAService.js:3:22347)
at http://1633418664.appservice.open.weixin.qq.com/WAService.js:3:26239
at http://1633418664.appservice.open.weixin.qq.com/WAService.js:1:30174
at Array.forEach (native)
at .<anonymous> (http://1633418664.appservice.open.weixin.qq.com/WAService.js:1:30154)
at http://1633418664.appservice.open.weixin.qq.com/WAService.js:2:6460
这么简单的代码,是我写错了吗?开发工具版本140900
this.setDate({
v4:"v4444"
})
this.setData 写错了
本回答被网友采纳