0👍
✅
Directives are not attributes, they are non-HTML markup in the template that Vue processes away before creating HTML. You’re setting attributes on DOM elements well after Vue has created them from template. So what you are trying to do cannot be done.
You should probably set up a component – possibly a dynamic component – in whose template you can include all the appropriate directives, and then use multiple places. But I think your click
and v-model
directives are going to fight, as v-model
is going to change the value of masterCheckboxChecked
, and so is toggleMasterCheckbox
.
Source:stackexchange.com