We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fe951c commit d196b9dCopy full SHA for d196b9d
src/v2/guide/conditional.md
@@ -6,26 +6,17 @@ order: 7
6
7
## `v-if`
8
9
-在字符串模板中,比如 [Handlebars](https://handlebarsjs.com/),我们得像这样写一个条件块:
+`v-if` 指令用于条件性地渲染一块内容。这块内容只会在指令的表达式返回 truthy 值的时候被渲染。
10
11
``` html
12
-<!-- Handlebars 模板 -->
13
-{{#if ok}}
14
- <h1>Yes</h1>
15
-{{/if}}
16
-```
17
-
18
-在 Vue 中,我们使用 `v-if` 指令实现同样的功能:
19
20
-``` html
21
-<h1 v-if="ok">Yes</h1>
+<h1 v-if="awesome">Vue is awesome!</h1>
22
```
23
24
也可以用 `v-else` 添加一个“else 块”:
25
26
27
28
-<h1 v-else>No</h1>
+<h1 v-else>Oh no 😢</h1>
29
30
31
### 在 `<template>` 元素上使用 `v-if` 条件渲染分组
0 commit comments