TypeError: Cannot set property ‘form’ of undefined
1、data中未定义
2、
uni.showModal({
title: "提示",
content: "上传成功",
showCancel: false,
success: function (res) {
console.log(this);//undefined
if (res.confirm) {
that.image="";
that.form="";
}
},
});
以上代码中打印的this不是全局的,需要在外层增加 var that=this;
(若有错误请在评论区指正)