diff --git a/pages/reactivity/core/watch/watch-options.uvue b/pages/reactivity/core/watch/watch-options.uvue index 2caa7dd9d02ac952775ec862af4aab4c3c65a55a..ab41086a635c1f82e2bc705f5f78ef5b050ed28a 100644 --- a/pages/reactivity/core/watch/watch-options.uvue +++ b/pages/reactivity/core/watch/watch-options.uvue @@ -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 是åˆå§‹å€¼