[Vuejs]-Vue – Activate VNode Adjustment

0πŸ‘

The first argument you get is el this is the element that the directive is present on.

You can directly use this argument to manipulate the DOM element in your case adding a new CSS class

Vue.directive('editable', { 
    bind (el, binding, vnode) { 
         if(condition){
             el.className += " " + "hidden";
         }
   }
})

Leave a comment