0
votes

I using Vue3.0 and also use Vee-validate to validate my form. But I don't know why it keep showing blank page just like in this picture

I already do what they said in the documentations, here's my code

<form class="wrap" id="signup-form col-lg-5" @submit.prevent="processForm">
                    <div class="row mb-5">
                        <router-link :to="{'name': 'Home'}">
                            <span class="iconify" data-icon="ion:return-up-back-outline" data-width="25" data-height="25"></span>
                            <button class="btn">Back</button>
                        </router-link>
    
                    </div>
                    <!-- full name -->
                    <div class="form-group row">
                        <label for="name">Full Name <span class="text-danger">*</span></label>
                        <ValidationProvider rules="positive|odd" v-slot="err">
                        <input type="text" class="form-control" v-model.trim="name">
                        <span>{{ err.errors[0] }}</span>
                        </ValidationProvider>
                    </div>
      
                    <!-- submit button -->
                    <div class="row d-flex align-items-center">
                        <button type="submit" class="btn btn-outline-dark col-sm-4">Submit</button>
                        <p style="cursor:pointer;" class="col-sm-7">
                            <router-link :to="{name:'Login'}">Has an account? Login</router-link>
                        </p>
                    </div>
                </form>

And here's my script

<script>
import { ValidationProvider } from 'vee-validate';
import { extend } from 'vee-validate';

extend('odd', value => {
  return value % 2 !== 0;
});
extend('positive', value => {
  return value >= 0;
});

export default {
  name: 'RegisterForm',
  components: {
      ValidationProvider
  },
  data: function(){
      return{
          name: '',
      }
  },
  methods: {
    processForm() {
        this.$emit('form-submit', 
        {
            'name': this.email,
            'password': this.password,
        })
    }
  }
}
</script>

What should I change from the code? By the way, Is Vee-Validator should be assigned in main.js?

1

1 Answers

0
votes

Looks like you are using vee-validate v3.x, it isn't compatible with Vue 3

vee-validate v4 was released recently that supports Vue 3, but with a completely different API

https://vee-validate.logaretm.com/v4/