Skip to content

Update index.md #580

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

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/v2/style-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ computed: {

**如果一组 `v-if` + `v-else` 的元素类型相同,最好使用 `key` (比如两个 `<div>` 元素)。**

默认情况下,Vue 会尽可能高效的更新 DOM。这意味着其在相同类型的元素之间切换时,会修补以存在的元素,而不是将旧的元素移除然后在同一位置添加一个新元素。如果本不相同的元素被识别为相同,则会出现[意料之外的副作用](https://jsfiddle.net/chrisvfritz/bh8fLeds/)。
默认情况下,Vue 会尽可能高效的更新 DOM。这意味着其在相同类型的元素之间切换时,会修补已存在的元素,而不是将旧的元素移除然后在同一位置添加一个新元素。如果本不相同的元素被识别为相同,则会出现[意料之外的副作用](https://jsfiddle.net/chrisvfritz/bh8fLeds/)。

{% raw %}<div class="style-example example-bad">{% endraw %}
#### 反例
Expand Down