Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.

docs: Update refs-api.md #673

Merged
merged 6 commits into from
Sep 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api/refs-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ count.value++
console.log(count.value) // 1
```

如果将对象分配为 ref 值,则通过 [reactive](./basic-reactivity.html#reactive) 方法使该对象具有高度的响应式
如果将对象分配为 ref 值,则通过 [reactive](./basic-reactivity.html#reactive) 函数使该对象具有高度的响应式

**类型声明:**

Expand Down Expand Up @@ -114,7 +114,7 @@ stateAsRefs.foo.value++
console.log(state.foo) // 3
```

当从组合式函数返回响应式对象时,`toRefs` 非常有用,这样消费组件就可以在不丢失响应性的情况下对返回的对象进行分解/扩散
当从组合式函数返回响应式对象时,`toRefs` 非常有用,这样消费组件就可以在不丢失响应性的情况下对返回的对象进行解构/展开

```js
function useFeatureX() {
Expand Down Expand Up @@ -217,7 +217,7 @@ isReactive(foo.value) // false

## `triggerRef`

手动执行与 [`shallowRef`](#shallowref) 关联的任何副作用
手动执行与 [`shallowRef`](#shallowref) 关联的任何作用 (effect)

```js
const shallow = shallowRef({
Expand All @@ -229,7 +229,7 @@ watchEffect(() => {
console.log(shallow.value.greet)
})

// 这不会触发副作用,因为 ref 是浅层的
// 这不会触发作用 (effect),因为 ref 是浅层的
shallow.value.greet = 'Hello, universe'

// 记录 "Hello, universe"
Expand Down