0
votes

I'm trying to use the vee-validate plugin for form validation without using npm install --save, so I copied the files in the dist folder into my project, but for some reason I can't use the plugin properly.

This is how I call the plugin as a script in my pug file register.pug:

block main-content
  .article#register
  form
    input(
      v-model="email"
      v-validate.initial="'required|email'"
      :class="{'input': true, 'is-danger': errors.has('email') }")
block page-specific-scripts
  script(data-minjs-group="register" src="/libs/vue/vee-validate.js")
  script(data-minjs-group="register" src="/scripts/onboarding/register.js")

And this is register.js:

(function(doc, win) {
  'use strict';

  var register = new Vue({ 
    el: '#register',
    data: {
      email: ''
    }
  });
})(document, window);

When I reload the page, I'm getting this message: "Property or method "errors" is not defined on the instance but referenced during render." which shouldn't be the case as I believe that errors is a built-in property of the vee-validate plugin.

1
Same problem. I tried on vee-validate version 3.1.3 and it didnt work. But I tried with version 2.0.6 and it worked for me.Abdullah Ilgaz

1 Answers

5
votes

You probably haven't added this.

Vue.use(VeeValidate);

(Add it before new Vue)