VM6066 WAService.js:4 thirdScriptError
Cannot read property 'getscdata' of null;at pages/writeword/writeword onReady function;at api showModal success callback function
TypeError: Cannot read property 'getscdata' of null
at success (http://127.0.0.1:56983/appservice/pages/writeword/writeword.js:153:32)
at Object.a.<computed> (http://127.0.0.1:56983/appservice/__dev__/WAService.js?t=wechat&s=1628375267452&v=2.3.0:7:12726)
at Function.<anonymous> (http://127.0.0.1:56983/appservice/__dev__/WAService.js?t=wechat&s=1628375267452&v=2.3.0:6:14313)
at Object.success (http://127.0.0.1:56983/appservice/__dev__/WAService.js?t=wechat&s=1628375267452&v=2.3.0:4:13561)
at s (http://127.0.0.1:56983/appservice/__dev__/WAService.js?t=wechat&s=1628375267452&v=2.3.0:6:10916)
at http://127.0.0.1:56983/appservice/__dev__/WAService.js?t=wechat&s=1628375267452&v=2.3.0:6:11094
at http://127.0.0.1:56983/appservice/__dev__/asdebug.js:1:40155
at I (http://127.0.0.1:56983/appservice/__dev__/asdebug.js:1:39810)
at http://127.0.0.1:56983/appservice/__dev__/asdebug.js:1:2852
at Set.forEach (<anonymous>)(env: Windows,mp,1.05.2107090; lib: 2.3.0)
错误原因:this在方法里面代表的是这个choseImage方法 而不是page对象,所以在外部定义一下this就好了
//获取上传数据
getscdata: function (marr) {
var scdata =[];
var zd ={}
for (var i = 0; i < marr.length; i++) {
if (marr[i].pxoperate > 0) {
zd={
'id':marr[i].id,
'pxoperate':marr[i].pxoperate,
'pxtime':marr[i].pxtime
};
console.log(zd);
scdata.push(zd) (错误 acdata.append(zd))
}
}
console.log(scdata);
return scdata;
},