Skip to content
New issue

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

[v4] initial value with v-model not displayed in v4.1.4 #3107

Closed
cexbrayat opened this issue Jan 5, 2021 · 3 comments
Closed

[v4] initial value with v-model not displayed in v4.1.4 #3107

cexbrayat opened this issue Jan 5, 2021 · 3 comments

Comments

@cexbrayat
Copy link
Contributor

Versions

  • vee-validate: 4.1.4
  • vue: 3.0.5

Describe the bug

Consider a simple form using Fiel with v-model:

<template>
  <h1>Register</h1>
  <Form>
    <Field as="input" rules="required" name="login" v-model="user.name"/>
    <ErrorMessage name="login" as="div"/>
  </Form>

</template>

<script>
import { reactive } from 'vue';
import { defineRule, ErrorMessage, Form, Field } from 'vee-validate'
import { required } from '@vee-validate/rules'

defineRule('required', required);

export default {
  components: {
    Form,
    Field,
    ErrorMessage
  },

  setup() {
    const user = reactive({ name: 'ced' });
    return { user }
  }
}
</script>

When bumping to v4.1.4, the initial value is no longer displayed in the input.

To reproduce

Steps to reproduce the behavior:
cexbrayat/vee-infinite-loop#7
yarn and yarn dev to witness the issue.

Rollback to v4.1.3, and run again to see that the initial value is displayed

Expected behavior

The v-model value should be displayed.

@logaretm
Copy link
Owner

logaretm commented Jan 5, 2021

Looks like it was caused by the changes in 504f30b

Just tagged 4.1.5 to fix it.

@diavrank
Copy link

I have the same issue with this:

<Field v-model="user.profile.name" type="text"  name="name" v-slot="{ field, errors }" rules="required">
                    <v-text-field v-bind="field" label="Full name"
                                  :error-messages="errors">
                    </v-text-field>
                  </Field>

the field is not showing the initial value until I put the mouse over it. Anyone knows how to fix it?

@farhad999
Copy link

farhad999 commented Jan 12, 2023

I have the same issue with this:

<Field v-model="user.profile.name" type="text"  name="name" v-slot="{ field, errors }" rules="required">
                    <v-text-field v-bind="field" label="Full name"
                                  :error-messages="errors">
                    </v-text-field>
                  </Field>

the field is not showing the initial value until I put the mouse over it. Anyone knows how to fix it?

I was stuck in this issue for a long time. You can solve this issue in following way

<Field v-model="user.profile.name" type="text"  name="name" v-slot="{ field, errors, value }" rules="required">
                    <v-text-field v-bind="field" :model-value="value" label="Full name"
                                  :error-messages="errors">
                    </v-text-field>
                  </Field>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants