From 8b8fb2f34f5263973995d3a7048f87c3b50061c8 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Tue, 28 May 2024 20:55:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(watch):=20=E8=A7=84=E9=81=BF=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/reactivity/core/watch/watch-options.uvue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pages/reactivity/core/watch/watch-options.uvue b/pages/reactivity/core/watch/watch-options.uvue index 2caa7dd..ab41086 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 是åˆå§‹å€¼ -- GitLab