This repository was archived by the owner on Aug 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 221
221
</script >
222
222
```
223
223
224
- 请注意,从 ` setup ` 返回的 [ refs] ( refs-api.html#ref ) 在模板中访问时会自动展开 ,因此模板中不需要 ` .value ` 。
224
+ 请注意,从 ` setup ` 返回的 [ refs] ( refs-api.html#ref ) 在模板中访问时会自动解包 ,因此模板中不需要 ` .value ` 。
225
225
226
226
- ** 渲染函数/JSX 的方法**
227
227
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export default {
92
92
}
93
93
```
94
94
95
- ` attrs ` 和 ` slots ` 是有状态的对象,它们总是会随组件本身的更新而更新。这意味着你应该避免对它们进行解构,并始终以 ` attrs.x ` 或 ` slots.x ` 的方式引用 property。请注意,与 ` props ` 不同,` attrs ` 和 ` slots` 是** 非** 响应式的。如果你打算根据 ` attrs ` 或 ` slots ` 更改应用副作用,那么应该在 ` onUpdated ` 生命周期钩子中执行此操作。
95
+ ` attrs ` 和 ` slots ` 是有状态的对象,它们总是会随组件本身的更新而更新。这意味着你应该避免对它们进行解构,并始终以 ` attrs.x ` 或 ` slots.x ` 的方式引用 property。请注意,与 ` props ` 不同,` attrs ` 和 ` slots ` 是** 非** 响应式的。如果你打算根据 ` attrs ` 或 ` slots ` 更改应用副作用,那么应该在 ` onUpdated ` 生命周期钩子中执行此操作。
96
96
97
97
## 访问组件的 property
98
98
@@ -137,7 +137,7 @@ export default {
137
137
</script>
138
138
```
139
139
140
- 注意,从 ` setup ` 返回的 [ refs] ( ../api/refs-api.html#ref ) 在模板中访问时是[ 被自动浅解包] ( /guide/reactivity-fundamentals.html#ref-展开 ) 的,因此不应在模板中使用 ` .value ` 。
140
+ 注意,从 ` setup ` 返回的 [ refs] ( ../api/refs-api.html#ref ) 在模板中访问时是[ 被自动浅解包] ( /guide/reactivity-fundamentals.html#ref-解包 ) 的,因此不应在模板中使用 ` .value ` 。
141
141
142
142
## 使用渲染函数
143
143
Original file line number Diff line number Diff line change @@ -43,9 +43,9 @@ count.value++
43
43
console .log (count .value ) // 1
44
44
```
45
45
46
- ### Ref 展开
46
+ ### Ref 解包
47
47
48
- 当 ref 作为渲染上下文 (从 [ setup()] ( composition-api-setup.html ) 中返回的对象) 上的 property 返回并可以在模板中被访问时,它将自动浅层次展开内部值 。只有访问嵌套的 ref 时需要在模板中添加 ` .value ` :
48
+ 当 ref 作为渲染上下文 (从 [ setup()] ( composition-api-setup.html ) 中返回的对象) 上的 property 返回并可以在模板中被访问时,它将自动浅层次解包内部值 。只有访问嵌套的 ref 时需要在模板中添加 ` .value ` :
49
49
50
50
``` vue-html
51
51
<template>
@@ -85,7 +85,7 @@ nested: reactive({
85
85
86
86
### 访问响应式对象
87
87
88
- 当 ` ref ` 作为响应式对象的 property 被访问或更改时,为使其行为类似于普通 property,它会自动展开内部值 :
88
+ 当 ` ref ` 作为响应式对象的 property 被访问或更改时,为使其行为类似于普通 property,它会自动解包内部值 :
89
89
90
90
``` js
91
91
const count = ref (0 )
@@ -109,7 +109,7 @@ console.log(state.count) // 2
109
109
console .log (count .value ) // 1
110
110
```
111
111
112
- Ref 展开仅发生在被响应式 ` Object ` 嵌套的时候。当从 ` Array ` 或原生集合类型如 [ ` Map ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map ) 访问 ref 时,不会进行展开 :
112
+ Ref 解包仅发生在被响应式 ` Object ` 嵌套的时候。当从 ` Array ` 或原生集合类型如 [ ` Map ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map ) 访问 ref 时,不会进行解包 :
113
113
114
114
``` js
115
115
const books = reactive ([ref (' Vue 3 Guide' )])
You can’t perform that action at this time.
0 commit comments