Skip to content

12 - 优化性能的指令 #2971

New issue

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

Open
diligent-zhang opened this issue May 31, 2025 · 0 comments
Open

12 - 优化性能的指令 #2971

diligent-zhang opened this issue May 31, 2025 · 0 comments

Comments

@diligent-zhang
Copy link

// 你的答案
<script setup> import { ref } from "vue" const count = ref(0) setInterval(() => { count.value++ }, 1000) </script> 使它从不更新: {{ count }}/* v-once只渲染一次,后又了解到v-model="[]"的方法,其实现的原理是v-memo 指令接受一个依赖项数组作为参数,只有当数组中的依赖项发生变化时,才会重新渲染绑定了 v-memo 的元素或组件。如果依赖项没有变化,Vue 会直接复用之前渲染的结果。,v-model绑定空也就不会发生后续的变化,维持前面的变化 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant