Back
VueEasyNew
What are Vue directives? Name some commonly used built-in ones
Special attributes prefixed with v-
Ideal Answer
Directives are special template attributes prefixed with v- that apply reactive behavior to the DOM. Common built-in directives:
v-bind(:) — bind an attribute/prop reactivelyv-on(@) — attach event listenersv-if/v-else-if/v-else— conditional renderingv-show— toggle visibility via CSSdisplayv-for— list renderingv-model— two-way bindingv-slot(#) — define named/scoped slotsv-html— render raw HTML (use with caution — XSS risk)v-once— render once and skip future updatesv-memo— memoize a template subtree based on dependencies