From c73779431896634ad159f5bedbaf4272da1ef802 Mon Sep 17 00:00:00 2001 From: Yukon123 <82578034+Yukon123@users.noreply.github.com> Date: Sun, 12 Sep 2021 00:06:42 +0800 Subject: [PATCH] docs: Add types of `key` --- src/api/special-attributes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/special-attributes.md b/src/api/special-attributes.md index 5dc0ad7962..961b57a6cd 100644 --- a/src/api/special-attributes.md +++ b/src/api/special-attributes.md @@ -2,7 +2,7 @@ ## key -- **Expects:** `number | string` +- **Expects:** `number | string | symbol ` The `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify VNodes when diffing the new list of nodes against the old list. Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed/destroyed.