Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Vue 3 v-once Directive

Vue 3 v-once Directive

Vue3 Built-in Directives Vue 3 Built-in Directives


v-once The directive is used to render an element or component only once; subsequent updates are skipped.


Basic Explanation

v-once The directive marks an element or component to be rendered only once. In subsequent re-renders, the element and all its children are treated as static content and skipped. This can be used to optimize update performance.


Use Cases

1. Static Content Optimization

When some content does not need to update, using v-once avoids unnecessary re-rendering:

Example


Vue3 Built-in Directives Vue 3 Built-in Directives