Vue 3 v-pre Directive
v-pre The directive is used to skip compilation, not performing Vue template parsing on the element and its children.
Basic Explanation
v-pre The directive tells Vue to skip compiling this element and all its children. Elements with v-pre are rendered as raw HTML, without Vue template syntax processing.
- Expected type: none (does not accept an expression)
- Purpose: skip compilation, not performing Vue template parsing on the element and its children.
Use Cases
1. Display Raw Mustache Tags
v-pre is most commonly used to display the raw {{ }} syntax:
Example
Normal render: {{ message }}
Uncompiled display: {{ message }}
Output result:
正常渲染: Hello Vue
不编译显示: {{ message }}
Vue 3 Built-in Directives