We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# App.vue <script setup lang="ts"> import { ref, watch } from "vue"; import HelloWorld from "./components/HelloWorld.vue"; const msg = ref({ name: 123, label: 789 }); const msg2 = ref({ name: 65, label: 456 }); watch([msg, msg2], () => { console.log(1); }); [msg.value, msg2.value] = [msg2.value, msg.value]; </script> <template> <HelloWorld v-model:msg="msg" v-model:msg2="msg2" /> </template>
// HelloWorld.vue
<script setup lang="ts"> let { msg, msg2 } = defineModels<{ msg: number; msg2: number; }>(); const onClick = () => { [msg2.value, msg.value] = [msg.value, msg2.value]; }; </script> <template> <button @click="onClick()">adsfsdf</button> </template>
第一次的交换,watch 只会监听到一次 当执行 HellowWorld 里的onClick 时,watch 会监听到两次
// 文档 我试了一下,如果编译后是这样的话,watch 监听到也是一次 所以到底是哪里出错了
https://github.com/zhengyimeng/test-defineModels.git
System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 180.11 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node Yarn: 4.0.0 - ~/.nvm/versions/node/v18.16.1/bin/yarn npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm pnpm: 8.10.2 - ~/.nvm/versions/node/v18.16.1/bin/pnpm bun: 0.1.8 - ~/.bun/bin/bun Browsers: Chrome: 119.0.6045.159 Safari: 16.2
yarn
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
// HelloWorld.vue
第一次的交换,watch 只会监听到一次
当执行 HellowWorld 里的onClick 时,watch 会监听到两次
// 文档
我试了一下,如果编译后是这样的话,watch 监听到也是一次
所以到底是哪里出错了
Reproduction
https://github.com/zhengyimeng/test-defineModels.git
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: