Skip to content

Only last element is accessible using ref in template-based functional components inside v-for loops #10171

Open
@Sumolari

Description

@Sumolari

Version

2.6.10

Reproduction link

https://codesandbox.io/s/vue-template-bqe44?fontsize=14

Steps to reproduce

  1. Create a functional component
  2. Use that functional component inside a v-for
  3. Add a ref binding to the functional component to be able to get the DOM element in parent component

What is expected?

The ref in parent component is an array of DOM elements, like it is an array of vNodes when applying this steps to a non-functional component

What is actually happening?

Only the last DOM element of the v-for is bound to the ref. It's also just an element and not an array


There's no warning about overriding previously existing ref

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions