提交 8b8fb2f3 编写于 作者: DCloud-WZF's avatar DCloud-WZF :speech_balloon:

refactor(watch): 规避运行时警告

上级 061cb81a
......@@ -158,8 +158,13 @@
handler(obj : Obj, prevObj ?: Obj) {
if (prevObj === null) {
this.watchObjRes = `obj: {"num":${obj.num},"str":"${obj.str}","bool":${obj.bool},"arr":${JSON.stringify(obj.arr)}}, prevObj: ${JSON.stringify(prevObj)}`
} else {
} else {
// #ifdef WEB
this.watchObjRes = `obj: {"num":${obj.num},"str":"${obj.str}","bool":${obj.bool},"arr":${JSON.stringify(obj.arr)}}, prevObj: {"num":${prevObj?.num},"str":"${prevObj?.str}","bool":${prevObj?.bool},"arr":${JSON.stringify(prevObj?.arr)}}`
// #endif
// #ifndef WEB
this.watchObjRes = `obj: {"num":${obj.num},"str":"${obj.str}","bool":${obj.bool},"arr":${JSON.stringify(obj.arr)}}, prevObj: {"num":${prevObj.num},"str":"${prevObj.str}","bool":${prevObj.bool},"arr":${JSON.stringify(prevObj.arr)}}`
// #endif
}
},
// immediate: true 第一次触发, 旧值应该是 undefined, 现在 app 是初始值
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部