Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(README): update unwrap ref in an array limitations #700

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
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
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