-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Open
Labels
Description
Vue version
3.2.45
Link to minimal reproduction
Steps to reproduce
Enter content in input
<script setup>
import { reactive } from 'vue'
const form = reactive({
text: 'xxx'
})
</script>
<template>
<form ref="form" @submit.prevent>
<span>form.text: </span>
<input v-model="form.text" type="text">
</form>
<p>
form.text:
<span style="color:green">{{ form.text }}</span>
(It should be consistent with input)
</p>
<button @click="$refs.form.requestSubmit()">submit</button>
</template>
What is expected?
named ref, Non-ref data should not be contaminated.
What is actually happening?
After mounted, the active data is overwritten by the template ref with the same name.
System Info
System:
OS: macOS 11.4
CPU: (8) arm64 Apple M1
Memory: 69.42 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.1/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Browsers:
Chrome: 108.0.5359.124
Safari: 14.1.1
npmPackages:
vue: ^3.2.45 => 3.2.45
Any additional comments?
This PR fixes it.
#7522