A
A
Andrey Sobolev2020-06-17 10:38:46
webpack
Andrey Sobolev, 2020-06-17 10:38:46

How to correctly include Vue and a file with Vue directives in Webpack with Babel?

I swear that I
Uncaught ReferenceError: Vue is not defined

connect Vue as a File with custom directives An example of the simplest first directive
window.Vue = require('./src/8/vue');

import './src/6/directives';

Vue.directive('get', {
    bind: function (el, binding, vnode) {
        let scope = vnode.context;
        axios
            .get(scope.geturl)
            .then((_json) => {
                scope.setItems(_json.data.items);
            });
    }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Sobolev, 2020-06-17
@andrufka46rus

Understood what was the matter. It was necessary to overturn Vue inside the directives file via import

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question