Vee-validate: Failed to resolve directive: validate

Created on 28 Jun 2017  ยท  4Comments  ยท  Source: logaretm/vee-validate

Versions:

  • VueJs: ^2.1.10
  • Vee-Validate: ^2.0.0-rc.6

Description:

Getting error that the validate directive failed to resolve

Steps To Reproduce:

Using Laravel with VueJS and am calling in the plugin like so:

window.VeeValidate = require('vee-validate');

So in my project I'm calling a parent component and multiple child components like so:
Tracker.vue > Calibration.vue > Ballot.vue > Lookup.vue

Ballot.vue and Lookup.vue are the two components where I'd like use this plugin since they are the only two with form fields.

My Ballot.vue file looks like so:

<template>
    <div class="ballot">
        <h1>Sign Your Name</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>

        <transition name="fade" mode="out-in">
            <form action="#">
                <div :class="{ 'control': true }">
                    <label for="exampleInputEmail1">First Name</label>
                    <input v-validate="'required|alpha'" type="text" name="firstname">
                </div>
                <button type="submit">Submit your name</button>
            </form>

            <lookup v-if="showLookup"></lookup>
        </transition>

    </div>
</template>

<script>

    // Import Component
    import Lookup from '../components/Lookup.vue';

    // Local Scope
    export default {
        data() {
            return {
                showLookup: false
            }
        },

        methods: {



        },

        components: {

            lookup: Lookup

        },

        mounted() {
            console.log(this);
        }
    }
</script>

โ” question

Most helpful comment

Doesn't solve the problem when running tests that use this.

Pages and pages of this:

image

All 4 comments

The plugin does not self install since you might need to modify the installation options, installing it should fix the issue:

window.Vue = require('vue');
window.VeeValidate = require('vee-validate');

window.Vue.use(window.VeeValidate);

Doesn't solve the problem when running tests that use this.

Pages and pages of this:

image

Same problem here. These warnings still appear in my jest tests.
(Vue 2.5.17, Vee-Validate 2.1.5, Jest 23.6.0)

Tests are run in own isolated environment. @kulosos and @darrynten do you include vee-validate into the testing environment as @logaretm suggested?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yyyuuu777 picture yyyuuu777  ยท  3Comments

Etheryte picture Etheryte  ยท  3Comments

biapar picture biapar  ยท  3Comments

YamenSharaf picture YamenSharaf  ยท  3Comments

7immer picture 7immer  ยท  3Comments