vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.39k stars 8.29k forks source link

when use @vue/compat in vue3 project, use emit('update:modelValue', val), v-model not effect #9242

Closed MuYi086 closed 1 year ago

MuYi086 commented 1 year ago

Vue version

3.3.4

Link to minimal reproduction

https://localhost:8089/

Steps to reproduce

floow the npm markdown, when use @vue/compat in vue3 project, child use emit('update:modelValue', val),
parent v-model not effect. when commented @vue/compat code, it works

What is expected?

can you give me some suggestions .both use @vue/compat and let it works

What is actually happening?

In parent , v-model not effect

System Info

No response

Any additional comments?

No response

Alfred-Skyblue commented 1 year ago

Please provide a minimal runnable reproduction.

LinusBorg commented 1 year ago

If you are running the compat build in Vue 2 mode, then the parent that is using v-model on your component will listen for ìnput, notupdate:modelValue`.

You would have to deactivate the COMPONENT_V_MODEL compat flag in your app, or in that parent component's compat config.

https://v3-migration.vuejs.org/migration-build.html#compat-configuration

If that doesn't solve your problem, please provide a runnable reproduction that we can debug, or ask the community in "Discussions" tab or our discord.