diff --git a/src/api/application.md b/src/api/application.md index 8374b351ee..0e411709d9 100644 --- a/src/api/application.md +++ b/src/api/application.md @@ -646,8 +646,8 @@ Configure a prefix for all IDs generated via [useId()](/api/composition-api-help ```js // in a component: - const id1 = useId() // 'myApp:0' - const id2 = useId() // 'myApp:1' + const id1 = useId() // 'myApp-0' + const id2 = useId() // 'myApp-1' ``` ## app.config.throwUnhandledErrorInProduction {#app-config-throwunhandlederrorinproduction} diff --git a/src/api/reactivity-core.md b/src/api/reactivity-core.md index 61195ed0f2..6e4472abc9 100644 --- a/src/api/reactivity-core.md +++ b/src/api/reactivity-core.md @@ -306,7 +306,7 @@ Runs a function immediately while reactively tracking its dependencies and re-ru ```js watchEffect(async (onCleanup) => { - const { response, cancel } = doAsyncWork(newId) + const { response, cancel } = doAsyncWork(id.value) // `cancel` will be called if `id` changes, cancelling // the previous request if it hasn't completed yet onCleanup(cancel) @@ -320,7 +320,7 @@ Runs a function immediately while reactively tracking its dependencies and re-ru import { onWatcherCleanup } from 'vue' watchEffect(async () => { - const { response, cancel } = doAsyncWork(newId) + const { response, cancel } = doAsyncWork(id.value) // `cancel` will be called if `id` changes, cancelling // the previous request if it hasn't completed yet onWatcherCleanup(cancel) @@ -513,7 +513,7 @@ Watches one or more reactive data sources and invokes a callback function when t Pausing / resuming the watcher: ```js - const { stop, pause, resume } = watch(() => {}) + const { stop, pause, resume } = watch(source, callback) // temporarily pause the watcher pause() diff --git a/src/api/reactivity-utilities.md b/src/api/reactivity-utilities.md index 21929c7f8f..d8d0341602 100644 --- a/src/api/reactivity-utilities.md +++ b/src/api/reactivity-utilities.md @@ -184,7 +184,7 @@ Converts a reactive object to a plain object where each property of the resultin [K in keyof T]: ToRef } - type ToRef = T extends Ref ? T : Ref + type ToRef = T extends Ref ? T : Ref ``` - **Example** diff --git a/src/guide/extras/reactivity-in-depth.md b/src/guide/extras/reactivity-in-depth.md index 69c86bf0f3..42f594b06a 100644 --- a/src/guide/extras/reactivity-in-depth.md +++ b/src/guide/extras/reactivity-in-depth.md @@ -302,6 +302,10 @@ const plusOne = computed(() => count.value + 1, { // access plusOne, should trigger onTrack console.log(plusOne.value) +// onTrigger is only called while plusOne has a subscriber, +// such as a watcher or a component that renders it +watchEffect(() => plusOne.value) + // mutate count.value, should trigger onTrigger count.value++ ```