+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

})

Related questions

0 votes
asked Sep 12, 2023 in VueJS by GeorgeBell
0 votes
asked Sep 7, 2023 in VueJS by AdilsonLima
...