import { addClass, removeClass } from '../../helpers/Dom'; const loadingDirective: any = {}; loadingDirective.install = (Vue: any) => { Vue.directive('loading', { bind(el: HTMLElement, node: any) { if (node.value === true) { addClass(el, 'is-loading'); } }, update(el: HTMLElement, node: any) { if (node.value === true) { addClass(el, 'is-loading'); } else { removeClass(el, 'is-loading'); } }, unbind(el: HTMLElement, none: any) { removeClass(el, 'is-loading'); }, }); }; export default loadingDirective;