feat(runtime-core): add watchEffect API
BREAKING CHANGE: replae `watch(fn, options?)` with `watchEffect`
The `watch(fn, options?)` signature has been replaced by the new
`watchEffect` API, which has the same usage and behavior. `watch`
now only supports the `watch(source, cb, options?)` signautre.
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const { createApp, reactive, computed, watch, onMounted, onUnmounted } = Vue
|
||||
const { createApp, reactive, computed, watchEffect, onMounted, onUnmounted } = Vue
|
||||
|
||||
const STORAGE_KEY = 'todos-vuejs-3.x'
|
||||
const todoStorage = {
|
||||
@@ -119,7 +119,7 @@ createApp({
|
||||
})
|
||||
})
|
||||
|
||||
watch(() => {
|
||||
watchEffect(() => {
|
||||
todoStorage.save(state.todos)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user