diff --git a/src/apis/watch.ts b/src/apis/watch.ts index 4e1724a4..19df3e24 100644 --- a/src/apis/watch.ts +++ b/src/apis/watch.ts @@ -83,7 +83,7 @@ function getWatcherOption(options?: Partial): WatchOptions { ...{ immediate: false, deep: false, - flush: 'post', + flush: 'pre', }, ...options, } @@ -94,7 +94,7 @@ function getWatchEffectOption(options?: Partial): WatchOptions { ...{ immediate: true, deep: false, - flush: 'post', + flush: 'pre', }, ...options, } diff --git a/test/apis/watch.spec.js b/test/apis/watch.spec.js index c480f1b2..33f5b626 100644 --- a/test/apis/watch.spec.js +++ b/test/apis/watch.spec.js @@ -178,7 +178,7 @@ describe('api/watch', () => { spy(newVal, oldVal) rerenderedText = vm.$el.textContent }, - { lazy: true } + { lazy: true, flush: 'post' } ) return { a, @@ -210,7 +210,7 @@ describe('api/watch', () => { rerenderedText = vm.$el.textContent } }, - { immediate: true } + { immediate: true, flush: 'post' } ) return { a,