Closed wJoenn closed 7 months ago
Looks like defineExpose
will solve this.
<script setup>
const task = ref('');
defineExpose({
task
})
</script>
Also, vuelidate 2 supports the Composition API.
Looks like defineExpose will solve this
Can confirm it does !
If there an official API to solve this then I suppose it's not a bug but the intended behaviour then. I wonder why it used to work with @nuxtjs/composition-api
🤷
Also, vuelidate 2 supports the Composition API.
Yeah but we don't really like the way the changes vuelidate in the newest version. We decided to move to vee-validate instead but we have a lot of forms to refactor which will be done over a few weeks so we had to make Bridge work with vuelidate 0
#
Thanks a lot for the help Wattanx 🙌
Environment
Build Modules: (), @nuxt/bridge@3.1.0
Reproduction
https://stackblitz.com/edit/github-fxasxi?file=pages%2Findex.vue
Describe the bug
Before updating our application from 2.15.7 + @nuxtjs/composition-api to 2.17.2 + bridge we used to create components in a
script setup
tag and use Vuelidate's validations on variables declared in thesetup
script from an adjacentscript
tag. (It's necessary to keep vuelidate's validations inside a classicscript
becaus eit's not compatible with the composition API)Since we updated, this is no longer possible. The
setup
variables are now inaccessible in thescript
so Vuelidate keeps trying to validate the presence of an undefined variable instead of the actualref
I thought it would be solved with https://github.com/nuxt/bridge/pull/1104 but even after updating bridge to 3.1 is does not solve the problem
#
You can test this from the reproduction, simply input anything in the text field then press submit and notice how
undefined
is being logged in the devtool and the validation errors is set totrue
(meaning the validation didn't succeed)Additional context
No response
Logs
No response