Skip to content

[Input] Access to native input via template refΒ #8113

@c01nd01r

Description

@c01nd01r
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

macos 14.1, Chrome 134, Vue 3.5.13

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Use ref or useTemplateRef to get the native input.

What is expected?

The native input has been accessed.

What is actually happening?

The native input is undefined


Hello!

I tried to get the native input in the Input component using ref or useTemplateRef, but I keep getting undefined.
Moreover, the object I receive in ref and inspect in the dev console seems to reference itself recursively, i.e., inputRef.value.input.input.

How can I correctly get a reference to the native input?

Example in CodeSandbox (a fork from the current documentation):
πŸ”— CodeSandbox - Ant Design Vue 4.2.6

Log screenshot Image

I also tried this in Ant Design Vue 3.2.20, and the issue doesn’t occur there:
πŸ”— CodeSandbox - Ant Design Vue 3.2.20

Log screenshot Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions