We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
只渲染元素和组件一次。随后的重新渲染,元素/组件及其所有的子节点将被视为静态内容并跳过。
https://cn.vuejs.org/v2/api/#v-once
基本不会重新渲染的组件,可以加上 v-once 指令,用来优化更新性能。
<div v-once> <h1>Terms of Service</h1> ... a lot of static content ... </div>
通过使用 v-once 指令,可以执行一次性地插值,当数据改变时,插值处的内容不会更新。
<span v-once>这个将不会改变: {{ msg }}</span>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
v-once
只渲染元素和组件一次。随后的重新渲染,元素/组件及其所有的子节点将被视为静态内容并跳过。
使用场景
1、低开销的静态组件
基本不会重新渲染的组件,可以加上 v-once 指令,用来优化更新性能。
2、一次性插值
通过使用 v-once 指令,可以执行一次性地插值,当数据改变时,插值处的内容不会更新。
The text was updated successfully, but these errors were encountered: