Skip to content

Commit

Permalink
docs(README): update unwrap ref in an array limitations (#700)
Browse files Browse the repository at this point in the history
Refs do not unwrap in a reactive array or nested array of a reactive object since 3.0.0-alpha.6 version. Hence, there are not limitations. See issue: vuejs/core#737
  • Loading branch information
jspoetry committed May 22, 2021
1 parent 59c3ac3 commit 83de736
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,6 @@ export default {
### `Ref` Unwrap

`Unwrap` is not working with Array index.

<details>
<summary>
❌ <b>Should NOT</b> store <code>ref</code> as a <b>direct</b> child of <code>Array</code>
</summary>

```js
const state = reactive({
list: [ref(0)],
})
// no unwrap, `.value` is required
state.list[0].value === 0 // true

state.list.push(ref(1))
// no unwrap, `.value` is required
state.list[1].value === 1 // true
```

</details>

<details>
<summary>
❌ <b>Should NOT</b> use <code>ref</code> in a plain object when working with <code>Array</code>
Expand Down
21 changes: 0 additions & 21 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,6 @@ export default {
### `Ref` 自动展开 (unwrap)

数组索引属性无法进行自动展开:

<details>
<summary>
❌ <b>不要</b> 使用数组直接存取 <code>ref</code> 对象
</summary>

```js
const state = reactive({
list: [ref(0)],
})
// 不会自动展开, 须使用 `.value`
state.list[0].value === 0 // true

state.list.push(ref(1))
// 不会自动展开, 须使用 `.value`
state.list[1].value === 1 // true
```

</details>

<details>
<summary>
❌ <b>不要</b> 在数组中使用含有 <code>ref</code> 的普通对象
Expand Down

0 comments on commit 83de736

Please sign in to comment.