Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wrong value when using useTemplateRef and defineModel #12749

@zhaoyuqiqi

Description

@zhaoyuqiqi

Vue version

3.5.13

Link to minimal reproduction

https://codesandbox.io/p/devbox/4twzxl

Steps to reproduce

  • Use the use template to reference a Dom
  • Define a constant with the same name using defineModel
  • This constant becomes a reference to the DOM or component

Image

What is expected?

A constant is a model declared by defineModel

What is actually happening?

This constant is becomes a reference to the DOM or component

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC
    Memory: 2.08 GB / 4.01 GB
    Container: Yes
    Shell: Unknown
  Binaries:
    Node: 20.12.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.5.0 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    vue: ^3.5.13 => 3.5.13

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions