diff --git a/pages/component-instance/watch-function/child.uvue b/pages/component-instance/watch-function/child.uvue index deb6619636dc2e6b0838d0f3fe3f585547139e1f..e5cd2df3a668f540fec18d5170c1b934c9cd894f 100644 --- a/pages/component-instance/watch-function/child.uvue +++ b/pages/component-instance/watch-function/child.uvue @@ -12,38 +12,52 @@ 子组件 值是否变化 {{ changed }} + + immediate=true 值应为 true + {{ immediateChanged }} + + .row { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-bottom: 10px; + } + \ No newline at end of file diff --git a/pages/component-instance/watch-function/watch-function.test.js b/pages/component-instance/watch-function/watch-function.test.js index 16ccabafc64b3067b34bf0717cfa2edef2b3e9a0..d7c6b866350f2facf3c08fd9ae71f2a5129e6a54 100644 --- a/pages/component-instance/watch-function/watch-function.test.js +++ b/pages/component-instance/watch-function/watch-function.test.js @@ -14,6 +14,9 @@ describe('$watch()', () => { expect(value).not.toBe(initValue) expect(isChange).toBe(true) + + const isChange2 = await (await page.data()).immediateChanged + expect(isChange2).toBe(true) }) it('子组件 $watch() 生效', async () => { @@ -24,5 +27,8 @@ describe('$watch()', () => { expect(value).not.toBe(initValue) expect(isChange).toBe(true) + + const isChange2 = await (await comp.data()).immediateChanged + expect(isChange2).toBe(true) }) -}) +}) \ No newline at end of file diff --git a/pages/component-instance/watch-function/watch-function.uvue b/pages/component-instance/watch-function/watch-function.uvue index cdd7f9f76def82cb07e1c6e6e54e64affddf0e52..c89d271b3bceaef8c104eafbe144d72ee1d4a05a 100644 --- a/pages/component-instance/watch-function/watch-function.uvue +++ b/pages/component-instance/watch-function/watch-function.uvue @@ -12,54 +12,68 @@ 值是否变化 {{ changed }} + + immediate=true 值应为 true + {{ immediateChanged }} + + .row { + display: flex; + flex-direction: row; + justify-content: space-between; + margin-bottom: 10px; + } + \ No newline at end of file