Cleanest way to import/require a Vue.js directive? Cleanest way to import/require a Vue.js directive? vue.js vue.js

Cleanest way to import/require a Vue.js directive?


I got the solution,below is the code

import Vue from 'vue';export const global= { bind(el, binding, vnode) {     console.log('you code'); }};

this code goes in lets say directive/global.js file.Then in you app.js or entry point file use this

import { global } from './directive/global.js';Vue.directive('global', global);

first line will import the directive as we are using same name to only used global, second line to make you directive global. Hope it help.