From 2cc09cba882c92e4dee14404dceaa0508538651f Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Fri, 29 Nov 2024 23:03:08 +0800 Subject: [PATCH 1/4] docs: hide all the style-guide links until it's ready --- src/guide/essentials/conditional.md | 8 +++++++- src/guide/essentials/list.md | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/guide/essentials/conditional.md b/src/guide/essentials/conditional.md index e33ac4d272..5eb391d027 100644 --- a/src/guide/essentials/conditional.md +++ b/src/guide/essentials/conditional.md @@ -111,7 +111,13 @@ Generally speaking, `v-if` has higher toggle costs while `v-show` has higher ini ## `v-if` with `v-for` {#v-if-with-v-for} ::: warning Note -It's **not** recommended to use `v-if` and `v-for` on the same element due to implicit precedence. Refer to [style guide](/style-guide/rules-essential#avoid-v-if-with-v-for) for details. +It's **not** recommended to use `v-if` and `v-for` on the same element due to implicit precedence. + +There are two common cases where this can be tempting: + +- To filter items in a list (e.g. `v-for="user in users" v-if="user.isActive"`). In these cases, replace `users` with a new computed property that returns your filtered list (e.g. `activeUsers`). + +- To avoid rendering a list if it should be hidden (e.g. `v-for="user in users" v-if="shouldShowUsers"`). In these cases, move the `v-if` to a container element (e.g. `ul`, `ol`). ::: When `v-if` and `v-for` are both used on the same element, `v-if` will be evaluated first. See the [list rendering guide](list#v-for-with-v-if) for details. diff --git a/src/guide/essentials/list.md b/src/guide/essentials/list.md index 2f7943c86b..74a42ae396 100644 --- a/src/guide/essentials/list.md +++ b/src/guide/essentials/list.md @@ -224,7 +224,13 @@ Similar to template `v-if`, you can also use a `