-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
☔ has workaroundthis issue has a workaroundthis issue has a workaround🐛 bugUnintended behaviorUnintended behavior
Description
What happened?
It seems there is an issue when use FieldContextKey
Reproduction steps
I think this error happen when use component from auto import
export default defineNuxtConfig({
compatibilityDate: '2024-04-03',
devtools: { enabled: true },
typescript: {
typeCheck: true,
strict: true,
},
modules: ['@vee-validate/nuxt'],
veeValidate: {
autoImports: true,
componentNames: {
Form: 'VeeForm',
Field: 'VeeField',
FieldArray: 'VeeFieldArray',
ErrorMessage: 'VeeErrorMessage',
},
},
});
<script setup lang="ts"></script>
<template>
<form>
<VeeField v-slot="{ field }" label="Email" name="email">
<FormItem :id="field.name">
<input v-bind="field" placeholder="Test" />
</FormItem>
</VeeField>
<button>Submit</button>
</form>
</template>
Because when i import component from vee-validate directly, it's work
<script setup lang="ts">
import { Field } from 'vee-validate';
</script>
<template>
<form>
<Field v-slot="{ field }" label="Email" name="email">
<FormItem :id="field.name">
<input v-bind="field" placeholder="Test" />
</FormItem>
</Field>
<button>Submit</button>
</form>
</template>
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
- Firefox
- Chrome
- Safari
- Microsoft Edge
Relevant log output
[Vue warn]: injection "Symbol(vee-validate-field-instance)" not found.
at <FormItem id="email" >
at <Field label="Email" name="email" >
at <App>
at <NuxtRoot>
Demo link
https://stackblitz.com/edit/github-dlqgvf?file=composables%2FuseFormField.ts
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
☔ has workaroundthis issue has a workaroundthis issue has a workaround🐛 bugUnintended behaviorUnintended behavior