Skip to content

Commit

Permalink
fix: removed v-for for refs, close #400
Browse files Browse the repository at this point in the history
  • Loading branch information
NataliaTepluhina committed Sep 14, 2020
1 parent 528c660 commit 8abb7ee
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/api/special-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
<child-component :ref="(el) => child = el"></child-component>
```

When used on elements/components with `v-for`, the registered reference will be an Array containing DOM nodes or component instances.

An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you cannot access them on the initial render - they don't exist yet! `$refs` is also non-reactive, therefore you should not attempt to use it in templates for data-binding.

- **See also:** [Child Component Refs](../guide/component-template-refs.html)
Expand Down
2 changes: 0 additions & 2 deletions src/guide/component-template-refs.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ Also, you can add another `ref` to the component itself and use it to trigger `f
this.$refs.usernameInput.focusInput()
```

When `ref` is used together with `v-for`, the ref you get will be an array containing the child components mirroring the data source.

::: warning
`$refs` are only populated after the component has been rendered. It is only meant as an escape hatch for direct child manipulation - you should avoid accessing `$refs` from within templates or computed properties.
:::
Expand Down

0 comments on commit 8abb7ee

Please sign in to comment.