From 2ddd57f6874d2e0ce220ea189ae6ef681729020e Mon Sep 17 00:00:00 2001 From: "X.Q. Chen" <31237954+brenner8023@users.noreply.github.com> Date: Fri, 6 May 2022 18:31:06 +0800 Subject: [PATCH] docs: update code demo and code annotation (#931) --- README.md | 2 +- README.zh-CN.md | 2 +- src/apis/effectScope.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b2fa5eb9..cb206535 100644 --- a/README.md +++ b/README.md @@ -347,7 +347,7 @@ export default { > Similarly, in Vue 2 you will need to call `del` to [ensure a key deletion triggers view updates](https://vuejs.org/v2/api/#Vue-delete) in reactive objects (similar to `Vue.delete` but for `reactive objects` created by the Composition API). In Vue 3 you can just delete them by calling `delete foo.bar`. ```ts -import { reactive, set } from '@vue/composition-api' +import { reactive, set, del } from '@vue/composition-api' const a = reactive({ foo: 1 diff --git a/README.zh-CN.md b/README.zh-CN.md index c8e658b5..a61cdcb3 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -187,7 +187,7 @@ b.list[1].count === 1 // true > ⚠️ 警告: `set` 和 `del` 并非 Vue 3 的一部分。由于 [Vue 2.x 响应式系统的限制](https://vuejs.org/v2/guide/reactivity.html#For-Objects),我们在插件中提供该 API 作为添加响应式属性的一个变通方案。在 Vue 3 中,你只需要直接为属性赋值即可。 ```ts -import { reactive, set } from '@vue/composition-api' +import { reactive, set, del } from '@vue/composition-api' const a = reactive({ foo: 1 diff --git a/src/apis/effectScope.ts b/src/apis/effectScope.ts index cde52c5c..89521ed1 100644 --- a/src/apis/effectScope.ts +++ b/src/apis/effectScope.ts @@ -84,7 +84,7 @@ export function recordEffectScope( scope.effects.push(effect) return } - // destory on parent component unmounted + // destroy on parent component unmounted const vm = getCurrentInstance()?.proxy vm && vm.$on('hook:destroyed', () => effect.stop()) } @@ -103,7 +103,7 @@ export function onScopeDispose(fn: () => void) { } else if (__DEV__) { warn( `onScopeDispose() is called when there is no active effect scope` + - ` to be associated with.` + ` to be associated with.` ) } }