+2 votes
in VueJS by

What is function shorthand in directive hooks?

1 Answer

0 votes
by

In few cases, you may want the same behavior on bind and update hooks irrespective of other hooks. In this situation you can use function shorthand,

Vue.directive('theme-switcher', function (el, binding) {

  el.style.backgroundColor = binding.value

})

...