Skip to content
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

【文章错误】v-if和v-for的优先级是什么? #449

Open
sakuraneo opened this issue Aug 28, 2024 · 1 comment
Open

【文章错误】v-if和v-for的优先级是什么? #449

sakuraneo opened this issue Aug 28, 2024 · 1 comment

Comments

@sakuraneo
Copy link

sakuraneo commented Aug 28, 2024

在vue官网明确说明,v-if的优先级比v-for更高并说明了原因,但文章中依然通过过时的源码说明v-for比v-if优先级更高

当它们同时存在于一个节点上时,v-if 比 v-for 的优先级更高。这意味着 v-if 的条件将无法访问到 v-for 作用域内定义的变量别名
https://cn.vuejs.org/guide/essentials/list.html#v-for-with-v-if

望勘误

@HeKingWu
Copy link

vue2跟vue3不同,vue2中v-for的优先级高,文章中写的应该是针对vue2的描述

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants