@vue/language-service 1.7.8 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/template/en.json +8 -0
- package/data/template/fr.json +8 -0
- package/data/template/ja.json +8 -0
- package/data/template/ko.json +8 -0
- package/data/template/zh-cn.json +8 -0
- package/out/ideFeatures/nameCasing.d.ts +2 -1
- package/out/ideFeatures/nameCasing.js +13 -20
- package/out/languageService.js +11 -9
- package/out/plugins/data.js +0 -9
- package/out/plugins/vue-autoinsert-dotvalue.js +3 -6
- package/out/plugins/vue-template.js +21 -14
- package/out/plugins/vue-twoslash-queries.js +3 -5
- package/out/plugins/vue.js +2 -3
- package/package.json +15 -14
- package/data/language-blocks/zh-tw.json +0 -626
- package/data/model-modifiers/zh-tw.json +0 -104
- package/data/template/zh-tw.json +0 -866
package/data/template/zh-tw.json
DELETED
|
@@ -1,866 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 1.1,
|
|
3
|
-
"tags": [
|
|
4
|
-
{
|
|
5
|
-
"name": "Transition",
|
|
6
|
-
"description": {
|
|
7
|
-
"kind": "markdown",
|
|
8
|
-
"value": "\n為**單個**元素或組件提供動畫過渡效果。\n\n- **Props**\n\n ```ts\n interface TransitionProps {\n /**\n * 用於自動生成過渡 CSS class 名。\n * 例如 `name: 'fade'` 將自動擴展為 `.fade-enter`、\n * `.fade-enter-active` 等。\n */\n name?: string\n /**\n * 是否應用 CSS 過渡 class。\n * 默認:true\n */\n css?: boolean\n /**\n * 指定要等待的過渡事件類型\n * 來確定過渡結束的時間。\n * 默認情況下會自動檢測\n * 持續時間較長的類型。\n */\n type?: 'transition' | 'animation'\n /**\n * 顯式指定過渡的持續時間。\n * 默認情況下是等待過渡效果的根元素的第一個 `transitionend`\n * 或`animationend`事件。\n */\n duration?: number | { enter: number; leave: number }\n /**\n * 控制離開/進入過渡的時序。\n * 默認情況下是同時的。\n */\n mode?: 'in-out' | 'out-in' | 'default'\n /**\n * 是否對初始渲染使用過渡。\n * 默認:false\n */\n appear?: boolean\n\n /**\n * 用於自定義過渡 class 的 prop。\n * 在模板中使用短橫線命名,例如:enter-from-class=\"xxx\"\n */\n enterFromClass?: string\n enterActiveClass?: string\n enterToClass?: string\n appearFromClass?: string\n appearActiveClass?: string\n appearToClass?: string\n leaveFromClass?: string\n leaveActiveClass?: string\n leaveToClass?: string\n }\n ```\n\n- **事件**\n\n - `@before-enter`\n - `@before-leave`\n - `@enter`\n - `@leave`\n - `@appear`\n - `@after-enter`\n - `@after-leave`\n - `@after-appear`\n - `@enter-cancelled`\n - `@leave-cancelled` (`v-show` only)\n - `@appear-cancelled`\n\n- **示例**\n\n 簡單元素:\n\n ```html\n <Transition>\n <div v-if=\"ok\">toggled content</div>\n </Transition>\n ```\n\n 通過改變 `key` 屬性來強制過度執行:\n \n ```html\n <Transition>\n <div :key=\"text\">{{ text }}</div>\n </Transition>\n ```\n\n 動態組件,初始渲染時帶有過渡模式 + 動畫出現:\n\n ```html\n <Transition name=\"fade\" mode=\"out-in\" appear>\n <component :is=\"view\"></component>\n </Transition>\n ```\n\n 監聽過渡事件:\n\n ```html\n <Transition @after-enter=\"onTransitionComplete\">\n <div v-show=\"ok\">toggled content</div>\n </Transition>\n ```\n\n- **參考**:[`<Transition>` 指南](https://cn.vuejs.org/guide/built-ins/transition.html)\n"
|
|
9
|
-
},
|
|
10
|
-
"references": [
|
|
11
|
-
{
|
|
12
|
-
"name": "en",
|
|
13
|
-
"url": "https://vuejs.org/api/built-in-components.html#transition"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "zh-cn",
|
|
17
|
-
"url": "https://cn.vuejs.org/api/built-in-components.html#transition"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"name": "ja",
|
|
21
|
-
"url": "https://ja.vuejs.org/api/built-in-components.html#transition"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "ua",
|
|
25
|
-
"url": "https://ua.vuejs.org/api/built-in-components.html#transition"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "fr",
|
|
29
|
-
"url": "https://fr.vuejs.org/api/built-in-components.html#transition"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "ko",
|
|
33
|
-
"url": "https://ko.vuejs.org/api/built-in-components.html#transition"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"name": "TransitionGroup",
|
|
39
|
-
"description": {
|
|
40
|
-
"kind": "markdown",
|
|
41
|
-
"value": "\n為列表中的**多個**元素或組件提供過渡效果。\n\n- **Props**\n\n `<TransitionGroup>` 擁有與 `<Transition>` 除了 `mode` 以外所有的 props,並增加了兩個額外的 props:\n\n ```ts\n interface TransitionGroupProps extends Omit<TransitionProps, 'mode'> {\n /**\n * 如果未定義,則渲染為片段 (fragment)。\n */\n tag?: string\n /**\n * 用於自定義過渡期間被應用的 CSS class。\n * 在模板中使用 kebab-case,例如 move-class=\"xxx\"\n */\n moveClass?: string\n }\n ```\n\n- **事件**\n\n `<TransitionGroup>` 拋出與 `<Transition>` 相同的事件。\n\n- **詳細信息**\n\n 默認情況下,`<TransitionGroup>` 不會渲染一個容器 DOM 元素,但是可以通過 `tag` prop 啟用。\n\n 注意,每個 `<transition-group>` 的子節點必須有[**獨立的 key**](https://cn.vuejs.org/guide/essentials/list.html#maintaining-state-with-key),動畫才能正常工作。\n\n `<TransitionGroup>` 支持通過 CSS transform 控制移動效果。當一個子節點在屏幕上的位置在更新之後發生變化時,它會被添加一個使其位移的 CSS class (基於 `name` attribute 推導,或使用 `move-class` prop 顯式配置)。如果使其位移的 class 被添加時 CSS 的 `transform` 屬性是“可過渡的”,那麼該元素會基於 [FLIP 技巧](https://aerotwist.com/blog/flip-your-animations/)平滑地到達動畫終點。\n\n- **示例**\n\n ```html\n <TransitionGroup tag=\"ul\" name=\"slide\">\n <li v-for=\"item in items\" :key=\"item.id\">\n {{ item.text }}\n </li>\n </TransitionGroup>\n ```\n\n- **參考**:[指南 - TransitionGroup](https://cn.vuejs.org/guide/built-ins/transition-group.html)\n"
|
|
42
|
-
},
|
|
43
|
-
"references": [
|
|
44
|
-
{
|
|
45
|
-
"name": "en",
|
|
46
|
-
"url": "https://vuejs.org/api/built-in-components.html#transitiongroup"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"name": "zh-cn",
|
|
50
|
-
"url": "https://cn.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "ja",
|
|
54
|
-
"url": "https://ja.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"name": "ua",
|
|
58
|
-
"url": "https://ua.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"name": "fr",
|
|
62
|
-
"url": "https://fr.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "ko",
|
|
66
|
-
"url": "https://ko.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"name": "KeepAlive",
|
|
72
|
-
"description": {
|
|
73
|
-
"kind": "markdown",
|
|
74
|
-
"value": "\n緩存包裹在其中的動態切換組件。\n\n- **Props**\n\n ```ts\n interface KeepAliveProps {\n /**\n * 如果指定,則只有與 `include` 名稱\n * 匹配的組件才會被緩存。\n */\n include?: MatchPattern\n /**\n * 任何名稱與 `exclude`\n * 匹配的組件都不會被緩存。\n */\n exclude?: MatchPattern\n /**\n * 最多可以緩存多少組件實例。\n */\n max?: number | string\n }\n\n type MatchPattern = string | RegExp | (string | RegExp)[]\n ```\n\n- **詳細信息**\n\n `<KeepAlive>` 包裹動態組件時,會緩存不活躍的組件實例,而不是銷燬它們。\n\n 任何時候都只能有一個活躍組件實例作為 `<KeepAlive>` 的直接子節點。\n\n 當一個組件在 `<KeepAlive>` 中被切換時,它的 `activated` 和 `deactivated` 生命週期鉤子將被調用,用來替代 `mounted` 和 `unmounted`。這適用於 `<KeepAlive>` 的直接子節點及其所有子孫節點。\n\n- **示例**\n\n 基本用法:\n\n ```html\n <KeepAlive>\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n 與 `v-if` / `v-else` 分支一起使用時,同一時間只能有一個組件被渲染:\n\n ```html\n <KeepAlive>\n <comp-a v-if=\"a > 1\"></comp-a>\n <comp-b v-else></comp-b>\n </KeepAlive>\n ```\n\n 與 `<Transition>` 一起使用:\n\n ```html\n <Transition>\n <KeepAlive>\n <component :is=\"view\"></component>\n </KeepAlive>\n </Transition>\n ```\n\n 使用 `include` / `exclude`:\n\n ```html\n <!-- 用逗號分隔的字符串 -->\n <KeepAlive include=\"a,b\">\n <component :is=\"view\"></component>\n </KeepAlive>\n\n <!-- 正則表達式 (使用 `v-bind`) -->\n <KeepAlive :include=\"/a|b/\">\n <component :is=\"view\"></component>\n </KeepAlive>\n\n <!-- 數組 (使用 `v-bind`) -->\n <KeepAlive :include=\"['a', 'b']\">\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n 使用 `max`:\n\n ```html\n <KeepAlive :max=\"10\">\n <component :is=\"view\"></component>\n </KeepAlive>\n ```\n\n- **參考**:[指南 - KeepAlive](https://cn.vuejs.org/guide/built-ins/keep-alive.html)\n"
|
|
75
|
-
},
|
|
76
|
-
"references": [
|
|
77
|
-
{
|
|
78
|
-
"name": "en",
|
|
79
|
-
"url": "https://vuejs.org/api/built-in-components.html#keepalive"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "zh-cn",
|
|
83
|
-
"url": "https://cn.vuejs.org/api/built-in-components.html#keepalive"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"name": "ja",
|
|
87
|
-
"url": "https://ja.vuejs.org/api/built-in-components.html#keepalive"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"name": "ua",
|
|
91
|
-
"url": "https://ua.vuejs.org/api/built-in-components.html#keepalive"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"name": "fr",
|
|
95
|
-
"url": "https://fr.vuejs.org/api/built-in-components.html#keepalive"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"name": "ko",
|
|
99
|
-
"url": "https://ko.vuejs.org/api/built-in-components.html#keepalive"
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"name": "Teleport",
|
|
105
|
-
"description": {
|
|
106
|
-
"kind": "markdown",
|
|
107
|
-
"value": "\n將其插槽內容渲染到 DOM 中的另一個位置。\n\n- **Props**\n\n ```ts\n interface TeleportProps {\n /**\n * 必填項。指定目標容器。\n * 可以是選擇器或實際元素。\n */\n to: string | HTMLElement\n /**\n * 當值為 `true` 時,內容將保留在其原始位置\n * 而不是移動到目標容器中。\n * 可以動態更改。\n */\n disabled?: boolean\n }\n ```\n\n- **示例**\n\n 指定目標容器:\n\n ```html\n <teleport to=\"#some-id\" />\n <teleport to=\".some-class\" />\n <teleport to=\"[data-teleport]\" />\n ```\n\n 有條件地禁用:\n\n ```html\n <teleport to=\"#popup\" :disabled=\"displayVideoInline\">\n <video src=\"./my-movie.mp4\">\n </teleport>\n ```\n\n- **參考**:[指南 - Teleport](https://cn.vuejs.org/guide/built-ins/teleport.html)\n"
|
|
108
|
-
},
|
|
109
|
-
"references": [
|
|
110
|
-
{
|
|
111
|
-
"name": "en",
|
|
112
|
-
"url": "https://vuejs.org/api/built-in-components.html#teleport"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"name": "zh-cn",
|
|
116
|
-
"url": "https://cn.vuejs.org/api/built-in-components.html#teleport"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"name": "ja",
|
|
120
|
-
"url": "https://ja.vuejs.org/api/built-in-components.html#teleport"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"name": "ua",
|
|
124
|
-
"url": "https://ua.vuejs.org/api/built-in-components.html#teleport"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"name": "fr",
|
|
128
|
-
"url": "https://fr.vuejs.org/api/built-in-components.html#teleport"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"name": "ko",
|
|
132
|
-
"url": "https://ko.vuejs.org/api/built-in-components.html#teleport"
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"name": "Suspense",
|
|
138
|
-
"description": {
|
|
139
|
-
"kind": "markdown",
|
|
140
|
-
"value": "\n用於協調對組件樹中嵌套的異步依賴的處理。\n\n- **Props**\n\n ```ts\n interface SuspenseProps {\n timeout?: string | number\n }\n ```\n\n- **事件**\n\n - `@resolve`\n - `@pending`\n - `@fallback`\n\n- **詳細信息**\n\n `<Suspense>` 接受兩個插槽:`#default` 和 `#fallback`。它將在內存中渲染默認插槽的同時展示後備插槽內容。\n\n 如果在渲染時遇到異步依賴項 ([異步組件](https://cn.vuejs.org/guide/components/async.html)和具有 [`async setup()`](https://cn.vuejs.org/guide/built-ins/suspense.html#async-setup) 的組件),它將等到所有異步依賴項解析完成時再顯示默認插槽。\n\n- **參考**:[指南 - Suspense](https://cn.vuejs.org/guide/built-ins/suspense.html)\n"
|
|
141
|
-
},
|
|
142
|
-
"references": [
|
|
143
|
-
{
|
|
144
|
-
"name": "en",
|
|
145
|
-
"url": "https://vuejs.org/api/built-in-components.html#suspense"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"name": "zh-cn",
|
|
149
|
-
"url": "https://cn.vuejs.org/api/built-in-components.html#suspense"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"name": "ja",
|
|
153
|
-
"url": "https://ja.vuejs.org/api/built-in-components.html#suspense"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"name": "ua",
|
|
157
|
-
"url": "https://ua.vuejs.org/api/built-in-components.html#suspense"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"name": "fr",
|
|
161
|
-
"url": "https://fr.vuejs.org/api/built-in-components.html#suspense"
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"name": "ko",
|
|
165
|
-
"url": "https://ko.vuejs.org/api/built-in-components.html#suspense"
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"name": "component",
|
|
171
|
-
"description": {
|
|
172
|
-
"kind": "markdown",
|
|
173
|
-
"value": "\n一個用於渲染動態組件或元素的“元組件”。\n\n- **Props**\n\n ```ts\n interface DynamicComponentProps {\n is: string | Component\n }\n ```\n\n- **詳細信息**\n\n 要渲染的實際組件由 `is` prop 決定。\n\n - 當 `is` 是字符串,它既可以是 HTML 標籤名也可以是組件的註冊名。\n\n - 或者,`is` 也可以直接綁定到組件的定義。\n\n- **示例**\n\n 按註冊名渲染組件 (選項式 API):\n\n ```vue\n <script>\n import Foo from './Foo.vue'\n import Bar from './Bar.vue'\n\n export default {\n components: { Foo, Bar },\n data() {\n return {\n view: 'Foo'\n }\n }\n }\n </script>\n\n <template>\n <component :is=\"view\" />\n </template>\n ```\n\n 按定義渲染組件 (`<script setup>` 組合式 API):\n\n ```vue\n <script setup>\n import Foo from './Foo.vue'\n import Bar from './Bar.vue'\n </script>\n\n <template>\n <component :is=\"Math.random() > 0.5 ? Foo : Bar\" />\n </template>\n ```\n\n 渲染 HTML 元素:\n\n ```html\n <component :is=\"href ? 'a' : 'span'\"></component>\n ```\n\n [內置組件](./built-in-components)都可以傳遞給 `is`,但是如果想通過名稱傳遞則必須先對其進行註冊。舉例來說:\n\n ```vue\n <script>\n import { Transition, TransitionGroup } from 'vue'\n\n export default {\n components: {\n Transition,\n TransitionGroup\n }\n }\n </script>\n\n <template>\n <component :is=\"isGroup ? 'TransitionGroup' : 'Transition'\">\n ...\n </component>\n </template>\n ```\n\n 如果將組件本身傳遞給 `is` 而不是其名稱,則不需要註冊,例如在 `<script setup>` 中。\n\n 如果在 `<component>` 標籤上使用 `v-model`,模板編譯器會將其擴展為 `modelValue` prop 和 `update:modelValue` 事件監聽器,就像對任何其他組件一樣。但是,這與原生 HTML 元素不兼容,例如 `<input>` 或 `<select>`。因此,在動態創建的原生元素上使用 `v-model` 將不起作用:\n\n ```vue\n <script setup>\n import { ref } from 'vue'\n\n const tag = ref('input')\n const username = ref('')\n </script>\n\n <template>\n <!-- 由於 'input' 是原生 HTML 元素,因此這個 v-model 不起作用 -->\n <component :is=\"tag\" v-model=\"username\" />\n </template>\n ```\n\n 在實踐中,這種極端情況並不常見,因為原生表單字段通常包裹在實際應用的組件中。如果確實需要直接使用原生元素,那麼你可以手動將 `v-model` 拆分為 attribute 和事件。\n\n- **參考**:[動態組件](https://cn.vuejs.org/guide/essentials/component-basics.html#dynamic-components)\n"
|
|
174
|
-
},
|
|
175
|
-
"references": [
|
|
176
|
-
{
|
|
177
|
-
"name": "en",
|
|
178
|
-
"url": "https://vuejs.org/api/built-in-special-elements.html#component"
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
"name": "zh-cn",
|
|
182
|
-
"url": "https://cn.vuejs.org/api/built-in-special-elements.html#component"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"name": "ja",
|
|
186
|
-
"url": "https://ja.vuejs.org/api/built-in-special-elements.html#component"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"name": "ua",
|
|
190
|
-
"url": "https://ua.vuejs.org/api/built-in-special-elements.html#component"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"name": "fr",
|
|
194
|
-
"url": "https://fr.vuejs.org/api/built-in-special-elements.html#component"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"name": "ko",
|
|
198
|
-
"url": "https://ko.vuejs.org/api/built-in-special-elements.html#component"
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"name": "slot",
|
|
204
|
-
"description": {
|
|
205
|
-
"kind": "markdown",
|
|
206
|
-
"value": "\n表示模板中的插槽內容出口。\n\n- **Props**\n\n ```ts\n interface SlotProps {\n /**\n * 任何傳遞給 <slot> 的 prop 都可以作為作用域插槽\n * 的參數傳遞\n */\n [key: string]: any\n /**\n * 保留,用於指定插槽名。\n */\n name?: string\n }\n ```\n\n- **詳細信息**\n\n `<slot>` 元素可以使用 `name` attribute 來指定插槽名。當沒有指定 `name` 時,將會渲染默認插槽。傳遞給插槽元素的附加 attributes 將作為插槽 props,傳遞給父級中定義的作用域插槽。\n\n 元素本身將被其所匹配的插槽內容替換。\n\n Vue 模板裡的 `<slot>` 元素會被編譯到 JavaScript,因此不要與[原生 `<slot>` 元素](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot)進行混淆。\n\n- **參考**:[組件 - 插槽](https://cn.vuejs.org/guide/components/slots.html)\n"
|
|
207
|
-
},
|
|
208
|
-
"references": [
|
|
209
|
-
{
|
|
210
|
-
"name": "en",
|
|
211
|
-
"url": "https://vuejs.org/api/built-in-special-elements.html#slot"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
"name": "zh-cn",
|
|
215
|
-
"url": "https://cn.vuejs.org/api/built-in-special-elements.html#slot"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"name": "ja",
|
|
219
|
-
"url": "https://ja.vuejs.org/api/built-in-special-elements.html#slot"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"name": "ua",
|
|
223
|
-
"url": "https://ua.vuejs.org/api/built-in-special-elements.html#slot"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"name": "fr",
|
|
227
|
-
"url": "https://fr.vuejs.org/api/built-in-special-elements.html#slot"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"name": "ko",
|
|
231
|
-
"url": "https://ko.vuejs.org/api/built-in-special-elements.html#slot"
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"name": "template",
|
|
237
|
-
"description": {
|
|
238
|
-
"kind": "markdown",
|
|
239
|
-
"value": "\n當我們想要使用內置指令而不在 DOM 中渲染元素時,`<template>` 標籤可以作為佔位符使用。\n\n- **詳細信息**:\n\n 對 `<template>` 的特殊處理只有在它與以下任一指令一起使用時才會被觸發:\n\n - `v-if`、`v-else-if` 或 `v-else`\n - `v-for`\n - `v-slot`\n\n 如果這些指令都不存在,那麼它將被渲染成一個[原生的 `<template>` 元素](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template)。\n\n 帶有 `v-for` 的 `<template>` 也可以有一個 [`key` 屬性](https://cn.vuejs.org/api/built-in-special-attributes.html#key)。所有其他的屬性和指令都將被丟棄,因為沒有相應的元素,它們就沒有意義。\n\n 單文件組件使用[頂層的 `<template>` 標籤](https://cn.vuejs.org/api/sfc-spec.html#language-blocks)來包裹整個模板。這種用法與上面描述的 `<template>` 使用方式是有區別的。該頂層標籤不是模板本身的一部分,不支持指令等模板語法。\n\n- **參考**:\n - [指南 - `<template>` 上的 `v-if`](https://cn.vuejs.org/guide/essentials/conditional.html#v-if-on-template)\n - [指南 - `<template>` 上的 `v-for`](https://cn.vuejs.org/guide/essentials/list.html#v-for-on-template)\n - [指南 - 具名插槽](https://cn.vuejs.org/guide/components/slots.html#named-slots)\n"
|
|
240
|
-
},
|
|
241
|
-
"references": [
|
|
242
|
-
{
|
|
243
|
-
"name": "en",
|
|
244
|
-
"url": "https://vuejs.org/api/built-in-special-elements.html#template"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"name": "zh-cn",
|
|
248
|
-
"url": "https://cn.vuejs.org/api/built-in-special-elements.html#template"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"name": "ja",
|
|
252
|
-
"url": "https://ja.vuejs.org/api/built-in-special-elements.html#template"
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
"name": "ua",
|
|
256
|
-
"url": "https://ua.vuejs.org/api/built-in-special-elements.html#template"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"name": "fr",
|
|
260
|
-
"url": "https://fr.vuejs.org/api/built-in-special-elements.html#template"
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"name": "ko",
|
|
264
|
-
"url": "https://ko.vuejs.org/api/built-in-special-elements.html#template"
|
|
265
|
-
}
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
],
|
|
269
|
-
"globalAttributes": [
|
|
270
|
-
{
|
|
271
|
-
"name": "v-text",
|
|
272
|
-
"description": {
|
|
273
|
-
"kind": "markdown",
|
|
274
|
-
"value": "\n更新元素的文本內容。\n\n- **期望的綁定值類型:**`string`\n\n- **詳細信息**\n\n `v-text` 通過設置元素的 [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) 屬性來工作,因此它將覆蓋元素中所有現有的內容。如果你需要更新 `textContent` 的部分,應該使用 [mustache interpolations](https://cn.vuejs.org/guide/essentials/template-syntax.html#text-interpolation) 代替。\n\n- **示例**\n\n ```html\n <span v-text=\"msg\"></span>\n <!-- 等同於 -->\n <span>{{msg}}</span>\n ```\n\n- **參考**:[模板語法 - 文本插值](https://cn.vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n"
|
|
275
|
-
},
|
|
276
|
-
"references": [
|
|
277
|
-
{
|
|
278
|
-
"name": "en",
|
|
279
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-text"
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
"name": "zh-cn",
|
|
283
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-text"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"name": "ja",
|
|
287
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-text"
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"name": "ua",
|
|
291
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-text"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"name": "fr",
|
|
295
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-text"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"name": "ko",
|
|
299
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-text"
|
|
300
|
-
}
|
|
301
|
-
]
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"name": "v-html",
|
|
305
|
-
"description": {
|
|
306
|
-
"kind": "markdown",
|
|
307
|
-
"value": "\n更新元素的 [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML)。\n\n- **期望的綁定值類型:**`string`\n\n- **詳細信息**\n\n `v-html` 的內容直接作為普通 HTML 插入—— Vue 模板語法是不會被解析的。如果你發現自己正打算用 `v-html` 來編寫模板,不如重新想想怎麼使用組件來代替。\n\n ::: warning 安全說明\n 在你的站點上動態渲染任意的 HTML 是非常危險的,因為它很容易導致 [XSS 攻擊](https://en.wikipedia.org/wiki/Cross-site_scripting)。請只對可信內容使用 HTML 插值,**絕不要**將用戶提供的內容作為插值\n :::\n\n 在[單文件組件](https://cn.vuejs.org/guide/scaling-up/sfc.html),`scoped` 樣式將不會作用於 `v-html` 裡的內容,因為 HTML 內容不會被 Vue 的模板編譯器解析。如果你想讓 `v-html` 的內容也支持 scoped CSS,你可以使用 [CSS modules](./sfc-css-features#css-modules) 或使用一個額外的全局 `<style>` 元素,手動設置類似 BEM 的作用域策略。\n\n- **示例:**\n\n ```html\n <div v-html=\"html\"></div>\n ```\n\n- **參考**:[模板語法 - 原始 HTML](https://cn.vuejs.org/guide/essentials/template-syntax.html#raw-html)\n"
|
|
308
|
-
},
|
|
309
|
-
"references": [
|
|
310
|
-
{
|
|
311
|
-
"name": "en",
|
|
312
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-html"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"name": "zh-cn",
|
|
316
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-html"
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
"name": "ja",
|
|
320
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-html"
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
"name": "ua",
|
|
324
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-html"
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
"name": "fr",
|
|
328
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-html"
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
"name": "ko",
|
|
332
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-html"
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
"name": "v-show",
|
|
338
|
-
"description": {
|
|
339
|
-
"kind": "markdown",
|
|
340
|
-
"value": "\n基於表達式值的真假性,來改變元素的可見性。\n\n- **期望的綁定值類型:**`any`\n\n- **詳細信息**\n\n `v-show` 通過設置內聯樣式的 `display` CSS 屬性來工作,當元素可見時將使用初始 `display` 值。當條件改變時,也會觸發過渡效果。\n\n- **參考**:[條件渲染 - v-show](https://cn.vuejs.org/guide/essentials/conditional.html#v-show)\n"
|
|
341
|
-
},
|
|
342
|
-
"references": [
|
|
343
|
-
{
|
|
344
|
-
"name": "en",
|
|
345
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-show"
|
|
346
|
-
},
|
|
347
|
-
{
|
|
348
|
-
"name": "zh-cn",
|
|
349
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-show"
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"name": "ja",
|
|
353
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-show"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"name": "ua",
|
|
357
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-show"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
"name": "fr",
|
|
361
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-show"
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
"name": "ko",
|
|
365
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-show"
|
|
366
|
-
}
|
|
367
|
-
]
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
"name": "v-if",
|
|
371
|
-
"description": {
|
|
372
|
-
"kind": "markdown",
|
|
373
|
-
"value": "\n基於表達式值的真假性,來條件性地渲染元素或者模板片段。\n\n- **期望的綁定值類型:**`any`\n\n- **詳細信息**\n\n 當 `v-if` 元素被觸發,元素及其所包含的指令/組件都會銷燬和重構。如果初始條件是假,那麼其內部的內容根本都不會被渲染。\n\n 可用於 `<template>` 表示僅包含文本或多個元素的條件塊。\n\n 當條件改變時會觸發過渡效果。\n\n 當同時使用時,`v-if` 比 `v-for` 優先級更高。我們並不推薦在一元素上同時使用這兩個指令 — 查看[列表渲染指南](https://cn.vuejs.org/guide/essentials/list.html#v-for-with-v-if)詳情。\n\n- **參考**:[條件渲染 - v-if](https://cn.vuejs.org/guide/essentials/conditional.html#v-if)\n"
|
|
374
|
-
},
|
|
375
|
-
"references": [
|
|
376
|
-
{
|
|
377
|
-
"name": "en",
|
|
378
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-if"
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
"name": "zh-cn",
|
|
382
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-if"
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
"name": "ja",
|
|
386
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-if"
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
"name": "ua",
|
|
390
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-if"
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
"name": "fr",
|
|
394
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-if"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"name": "ko",
|
|
398
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-if"
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
"name": "v-else",
|
|
404
|
-
"valueSet": "v",
|
|
405
|
-
"description": {
|
|
406
|
-
"kind": "markdown",
|
|
407
|
-
"value": "\n表示 `v-if` 或 `v-if` / `v-else-if` 鏈式調用的“else 塊”。\n\n- **無需傳入表達式**\n\n- **詳細信息**\n\n - 限定:上一個兄弟元素必須有 `v-if` 或 `v-else-if`。\n\n - 可用於 `<template>` 表示僅包含文本或多個元素的條件塊。\n\n- **示例**\n\n ```html\n <div v-if=\"Math.random() > 0.5\">\n Now you see me\n </div>\n <div v-else>\n Now you don't\n </div>\n ```\n\n- **參考**:[條件渲染 - v-else](https://cn.vuejs.org/guide/essentials/conditional.html#v-else)\n"
|
|
408
|
-
},
|
|
409
|
-
"references": [
|
|
410
|
-
{
|
|
411
|
-
"name": "en",
|
|
412
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-else"
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
"name": "zh-cn",
|
|
416
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-else"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"name": "ja",
|
|
420
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-else"
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
"name": "ua",
|
|
424
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-else"
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"name": "fr",
|
|
428
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-else"
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
"name": "ko",
|
|
432
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-else"
|
|
433
|
-
}
|
|
434
|
-
]
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
"name": "v-else-if",
|
|
438
|
-
"description": {
|
|
439
|
-
"kind": "markdown",
|
|
440
|
-
"value": "\n表示 `v-if` 的“else if 塊”。可以進行鏈式調用。\n\n- **期望的綁定值類型:**`any`\n\n- **詳細信息**\n\n - 限定:上一個兄弟元素必須有 `v-if` 或 `v-else-if`。\n\n - 可用於 `<template>` 表示僅包含文本或多個元素的條件塊。\n\n- **示例**\n\n ```html\n <div v-if=\"type === 'A'\">\n A\n </div>\n <div v-else-if=\"type === 'B'\">\n B\n </div>\n <div v-else-if=\"type === 'C'\">\n C\n </div>\n <div v-else>\n Not A/B/C\n </div>\n ```\n\n- **參考**:[條件渲染 - v-else-if](https://cn.vuejs.org/guide/essentials/conditional.html#v-else-if)\n"
|
|
441
|
-
},
|
|
442
|
-
"references": [
|
|
443
|
-
{
|
|
444
|
-
"name": "en",
|
|
445
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-else-if"
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
"name": "zh-cn",
|
|
449
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
"name": "ja",
|
|
453
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
"name": "ua",
|
|
457
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
"name": "fr",
|
|
461
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
"name": "ko",
|
|
465
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
466
|
-
}
|
|
467
|
-
]
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
"name": "v-for",
|
|
471
|
-
"description": {
|
|
472
|
-
"kind": "markdown",
|
|
473
|
-
"value": "\n基於原始數據多次渲染元素或模板塊。\n\n- **期望的綁定值類型:**`Array | Object | number | string | Iterable`\n\n- **詳細信息**\n\n 指令值必須使用特殊語法 `alias in expression` 為正在迭代的元素提供一個別名:\n\n ```html\n <div v-for=\"item in items\">\n {{ item.text }}\n </div>\n ```\n\n 或者,你也可以為索引指定別名 (如果用在對象,則是鍵值):\n\n ```html\n <div v-for=\"(item, index) in items\"></div>\n <div v-for=\"(value, key) in object\"></div>\n <div v-for=\"(value, name, index) in object\"></div>\n ```\n\n `v-for` 的默認方式是嘗試就地更新元素而不移動它們。要強制其重新排序元素,你需要用特殊 attribute `key` 來提供一個排序提示:\n\n ```html\n <div v-for=\"item in items\" :key=\"item.id\">\n {{ item.text }}\n </div>\n ```\n\n `v-for` 也可以用於 [Iterable Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) 的實現,包括原生 `Map` 和 `Set`。\n\n- **參考:**\n - [列表渲染](https://cn.vuejs.org/guide/essentials/list.html)\n"
|
|
474
|
-
},
|
|
475
|
-
"references": [
|
|
476
|
-
{
|
|
477
|
-
"name": "en",
|
|
478
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-for"
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
"name": "zh-cn",
|
|
482
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-for"
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
"name": "ja",
|
|
486
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-for"
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
"name": "ua",
|
|
490
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-for"
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
"name": "fr",
|
|
494
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-for"
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
"name": "ko",
|
|
498
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-for"
|
|
499
|
-
}
|
|
500
|
-
]
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
"name": "v-on",
|
|
504
|
-
"description": {
|
|
505
|
-
"kind": "markdown",
|
|
506
|
-
"value": "\n給元素綁定事件監聽器。\n\n- **縮寫:**`@`\n\n- **期望的綁定值類型:**`Function | Inline Statement | Object (不帶參數)`\n\n- **參數:**`event` (使用對象語法則為可選項)\n\n- **修飾符:**\n\n - `.stop` - 調用 `event.stopPropagation()`。\n - `.prevent` - 調用 `event.preventDefault()`。\n - `.capture` - 在捕獲模式添加事件監聽器。\n - `.self` - 只有事件從元素本身發出才觸發處理函數。\n - `.{keyAlias}` - 只在某些按鍵下觸發處理函數。\n - `.once` - 最多觸發一次處理函數。\n - `.left` - 只在鼠標左鍵事件觸發處理函數。\n - `.right` - 只在鼠標右鍵事件觸發處理函數。\n - `.middle` - 只在鼠標中鍵事件觸發處理函數。\n - `.passive` - 通過 `{ passive: true }` 附加一個 DOM 事件。\n\n- **詳細信息**\n\n 事件類型由參數來指定。表達式可以是一個方法名,一個內聯聲明,如果有修飾符則可省略。\n\n 當用於普通元素,只監聽[**原生 DOM 事件**](https://developer.mozilla.org/en-US/docs/Web/Events)。當用於自定義元素組件,則監聽子組件觸發的**自定義事件**。\n\n 當監聽原生 DOM 事件時,方法接收原生事件作為唯一參數。如果使用內聯聲明,聲明可以訪問一個特殊的 `$event` 變量:`v-on:click=\"handle('ok', $event)\"`。\n\n `v-on` 還支持綁定不帶參數的事件/監聽器對的對象。請注意,當使用對象語法時,不支持任何修飾符。\n\n- **示例:**\n\n ```html\n <!-- 方法處理函數 -->\n <button v-on:click=\"doThis\"></button>\n\n <!-- 動態事件 -->\n <button v-on:[event]=\"doThis\"></button>\n\n <!-- 內聯聲明 -->\n <button v-on:click=\"doThat('hello', $event)\"></button>\n\n <!-- 縮寫 -->\n <button @click=\"doThis\"></button>\n\n <!-- 使用縮寫的動態事件 -->\n <button @[event]=\"doThis\"></button>\n\n <!-- 停止傳播 -->\n <button @click.stop=\"doThis\"></button>\n\n <!-- 阻止默認事件 -->\n <button @click.prevent=\"doThis\"></button>\n\n <!-- 不帶表達式地阻止默認事件 -->\n <form @submit.prevent></form>\n\n <!-- 鏈式調用修飾符 -->\n <button @click.stop.prevent=\"doThis\"></button>\n\n <!-- 按鍵用於 keyAlias 修飾符-->\n <input @keyup.enter=\"onEnter\" />\n\n <!-- 點擊事件將最多觸發一次 -->\n <button v-on:click.once=\"doThis\"></button>\n\n <!-- 對象語法 -->\n <button v-on=\"{ mousedown: doThis, mouseup: doThat }\"></button>\n ```\n\n 監聽子組件的自定義事件 (當子組件的“my-event”事件被觸發,處理函數將被調用):\n\n ```html\n <MyComponent @my-event=\"handleThis\" />\n\n <!-- 內聯聲明 -->\n <MyComponent @my-event=\"handleThis(123, $event)\" />\n ```\n\n- **參考:**\n - [事件處理](https://cn.vuejs.org/guide/essentials/event-handling.html)\n - [組件 - 自定義事件](https://cn.vuejs.org/guide/essentials/component-basics.html#listening-to-events)\n"
|
|
507
|
-
},
|
|
508
|
-
"references": [
|
|
509
|
-
{
|
|
510
|
-
"name": "en",
|
|
511
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-on"
|
|
512
|
-
},
|
|
513
|
-
{
|
|
514
|
-
"name": "zh-cn",
|
|
515
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-on"
|
|
516
|
-
},
|
|
517
|
-
{
|
|
518
|
-
"name": "ja",
|
|
519
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-on"
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
"name": "ua",
|
|
523
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-on"
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
"name": "fr",
|
|
527
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-on"
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
"name": "ko",
|
|
531
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-on"
|
|
532
|
-
}
|
|
533
|
-
]
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
"name": "v-bind",
|
|
537
|
-
"description": {
|
|
538
|
-
"kind": "markdown",
|
|
539
|
-
"value": "\n動態的綁定一個或多個 attribute,也可以是組件的 prop。\n\n- **縮寫:**`:` 或者 `.` (當使用 `.prop` 修飾符)\n\n- **期望:**`any (帶參數) | Object (不帶參數)`\n\n- **參數:**`attrOrProp (可選的)`\n\n- **修飾符:**\n\n - `.camel` - 將短橫線命名的 attribute 轉變為駝峰式命名。\n - `.prop` - 強制綁定為 DOM property。<sup class=\"vt-badge\">3.2+</sup>\n - `.attr` - 強制綁定為 DOM attribute。<sup class=\"vt-badge\">3.2+</sup>\n\n- **用途:**\n\n 當用於綁定 `class` 或 `style` attribute,`v-bind` 支持額外的值類型如數組或對象。詳見下方的指南鏈接。\n\n 在處理綁定時,Vue 默認會利用 `in` 操作符來檢查該元素上是否定義了和綁定的 key 同名的 DOM property。如果存在同名的 property,則 Vue 會把作為 DOM property 賦值,而不是作為 attribute 設置。這個行為在大多數情況都符合期望的綁定值類型,但是你也可以顯式用 `.prop` 和 `.attr` 修飾符來強制綁定方式。有時這是必要的,特別是在和[自定義元素](https://cn.vuejs.org/guide/extras/web-components.html#passing-dom-properties)打交道時。\n\n 當用於組件 props 綁定時,所綁定的 props 必須在子組件中已被正確聲明。\n\n 當不帶參數使用時,可以用於綁定一個包含了多個 attribute 名稱-綁定值對的對象。\n\n- **示例:**\n\n ```html\n <!-- 綁定 attribute -->\n <img v-bind:src=\"imageSrc\" />\n\n <!-- 動態 attribute 名 -->\n <button v-bind:[key]=\"value\"></button>\n\n <!-- 縮寫 -->\n <img :src=\"imageSrc\" />\n\n <!-- 縮寫形式的動態 attribute 名 -->\n <button :[key]=\"value\"></button>\n\n <!-- 內聯字符串拼接 -->\n <img :src=\"'/path/to/images/' + fileName\" />\n\n <!-- class 綁定 -->\n <div :class=\"{ red: isRed }\"></div>\n <div :class=\"[classA, classB]\"></div>\n <div :class=\"[classA, { classB: isB, classC: isC }]\"></div>\n\n <!-- style 綁定 -->\n <div :style=\"{ fontSize: size + 'px' }\"></div>\n <div :style=\"[styleObjectA, styleObjectB]\"></div>\n\n <!-- 綁定對象形式的 attribute -->\n <div v-bind=\"{ id: someProp, 'other-attr': otherProp }\"></div>\n\n <!-- prop 綁定。“prop” 必須在子組件中已聲明。 -->\n <MyComponent :prop=\"someThing\" />\n\n <!-- 傳遞子父組件共有的 prop -->\n <MyComponent v-bind=\"$props\" />\n\n <!-- XLink -->\n <svg><a :xlink:special=\"foo\"></a></svg>\n ```\n\n `.prop` 修飾符也有專門的縮寫,`.`:\n\n ```html\n <div :someProperty.prop=\"someObject\"></div>\n\n <!-- 等同於 -->\n <div .someProperty=\"someObject\"></div>\n ```\n\n 當在 DOM 內模板使用 `.camel` 修飾符,可以駝峰化 `v-bind` attribute 的名稱,例如 SVG `viewBox` attribute:\n\n ```html\n <svg :view-box.camel=\"viewBox\"></svg>\n ```\n\n 如果使用字符串模板或使用構建步驟預編譯模板,則不需要 `.camel`。\n\n- **參考:**\n - [Class 與 Style 綁定](https://cn.vuejs.org/guide/essentials/class-and-style.html)\n - [組件 - Prop 傳遞細節](https://cn.vuejs.org/guide/components/props.html#prop-passing-details)\n"
|
|
540
|
-
},
|
|
541
|
-
"references": [
|
|
542
|
-
{
|
|
543
|
-
"name": "en",
|
|
544
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-bind"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
"name": "zh-cn",
|
|
548
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-bind"
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
"name": "ja",
|
|
552
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-bind"
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
"name": "ua",
|
|
556
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-bind"
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
"name": "fr",
|
|
560
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-bind"
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
"name": "ko",
|
|
564
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-bind"
|
|
565
|
-
}
|
|
566
|
-
]
|
|
567
|
-
},
|
|
568
|
-
{
|
|
569
|
-
"name": "v-model",
|
|
570
|
-
"description": {
|
|
571
|
-
"kind": "markdown",
|
|
572
|
-
"value": "\n在表單輸入元素或組件上創建雙向綁定。\n\n- **期望的綁定值類型**:根據表單輸入元素或組件輸出的值而變化\n\n- **僅限:**\n\n - `<input>`\n - `<select>`\n - `<textarea>`\n - components\n\n- **修飾符:**\n\n - [`.lazy`](https://cn.vuejs.org/guide/essentials/forms.html#lazy) - 監聽 `change` 事件而不是 `input`\n - [`.number`](https://cn.vuejs.org/guide/essentials/forms.html#number) - 將輸入的合法字符串轉為數字\n - [`.trim`](https://cn.vuejs.org/guide/essentials/forms.html#trim) - 移除輸入內容兩端空格\n\n- **參考:**\n\n - [表單輸入綁定](https://cn.vuejs.org/guide/essentials/forms.html)\n - [組件事件 - 配合 `v-model` 使用](https://cn.vuejs.org/guide/components/v-model.html)\n"
|
|
573
|
-
},
|
|
574
|
-
"references": [
|
|
575
|
-
{
|
|
576
|
-
"name": "en",
|
|
577
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-model"
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
"name": "zh-cn",
|
|
581
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-model"
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
"name": "ja",
|
|
585
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-model"
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
"name": "ua",
|
|
589
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-model"
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
"name": "fr",
|
|
593
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-model"
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
"name": "ko",
|
|
597
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-model"
|
|
598
|
-
}
|
|
599
|
-
]
|
|
600
|
-
},
|
|
601
|
-
{
|
|
602
|
-
"name": "v-slot",
|
|
603
|
-
"description": {
|
|
604
|
-
"kind": "markdown",
|
|
605
|
-
"value": "\n用於聲明具名插槽或是期望接收 props 的作用域插槽。\n\n- **縮寫:**`#`\n\n- **期望的綁定值類型**:能夠合法在函數參數位置使用的 JavaScript 表達式。支持解構語法。綁定值是可選的——只有在給作用域插槽傳遞 props 才需要。\n\n- **參數**:插槽名 (可選,默認是 `default`)\n\n- **僅限:**\n\n - `<template>`\n - [components](https://cn.vuejs.org/guide/components/slots.html#scoped-slots) (用於帶有 prop 的單個默認插槽)\n\n- **示例:**\n\n ```html\n <!-- 具名插槽 -->\n <BaseLayout>\n <template v-slot:header>\n Header content\n </template>\n\n <template v-slot:default>\n Default slot content\n </template>\n\n <template v-slot:footer>\n Footer content\n </template>\n </BaseLayout>\n\n <!-- 接收 prop 的具名插槽 -->\n <InfiniteScroll>\n <template v-slot:item=\"slotProps\">\n <div class=\"item\">\n {{ slotProps.item.text }}\n </div>\n </template>\n </InfiniteScroll>\n\n <!-- 接收 prop 的默認插槽,並解構 -->\n <Mouse v-slot=\"{ x, y }\">\n Mouse position: {{ x }}, {{ y }}\n </Mouse>\n ```\n\n- **參考:**\n - [組件 - 插槽](https://cn.vuejs.org/guide/components/slots.html)\n"
|
|
606
|
-
},
|
|
607
|
-
"references": [
|
|
608
|
-
{
|
|
609
|
-
"name": "en",
|
|
610
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-slot"
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
"name": "zh-cn",
|
|
614
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-slot"
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
"name": "ja",
|
|
618
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-slot"
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
"name": "ua",
|
|
622
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-slot"
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
"name": "fr",
|
|
626
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-slot"
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
"name": "ko",
|
|
630
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-slot"
|
|
631
|
-
}
|
|
632
|
-
]
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
"name": "v-pre",
|
|
636
|
-
"description": {
|
|
637
|
-
"kind": "markdown",
|
|
638
|
-
"value": "\n跳過該元素及其所有子元素的編譯。\n\n- **無需傳入**\n\n- **詳細信息**\n\n 元素內具有 `v-pre`,所有 Vue 模板語法都會被保留並按原樣渲染。最常見的用例就是顯示原始雙大括號標籤及內容。\n\n- **示例:**\n\n ```html\n <span v-pre>{{ this will not be compiled }}</span>\n ```\n"
|
|
639
|
-
},
|
|
640
|
-
"references": [
|
|
641
|
-
{
|
|
642
|
-
"name": "en",
|
|
643
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-pre"
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
"name": "zh-cn",
|
|
647
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-pre"
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
"name": "ja",
|
|
651
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-pre"
|
|
652
|
-
},
|
|
653
|
-
{
|
|
654
|
-
"name": "ua",
|
|
655
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-pre"
|
|
656
|
-
},
|
|
657
|
-
{
|
|
658
|
-
"name": "fr",
|
|
659
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-pre"
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
"name": "ko",
|
|
663
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-pre"
|
|
664
|
-
}
|
|
665
|
-
]
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
"name": "v-once",
|
|
669
|
-
"description": {
|
|
670
|
-
"kind": "markdown",
|
|
671
|
-
"value": "\n僅渲染元素和組件一次,並跳過之後的更新。\n\n- **無需傳入**\n\n- **詳細信息**\n\n 在隨後的重新渲染,元素/組件及其所有子項將被當作靜態內容並跳過渲染。這可以用來優化更新時的性能。\n\n ```html\n <!-- 單個元素 -->\n <span v-once>This will never change: {{msg}}</span>\n <!-- 帶有子元素的元素 -->\n <div v-once>\n <h1>comment</h1>\n <p>{{msg}}</p>\n </div>\n <!-- 組件 -->\n <MyComponent v-once :comment=\"msg\" />\n <!-- `v-for` 指令 -->\n <ul>\n <li v-for=\"i in list\" v-once>{{i}}</li>\n </ul>\n ```\n\n 從 3.2 起,你也可以搭配 [`v-memo`](#v-memo) 的無效條件來緩存部分模板。\n\n- **參考:**\n - [數據綁定語法 - 插值](https://cn.vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n - [v-memo](#v-memo)\n"
|
|
672
|
-
},
|
|
673
|
-
"references": [
|
|
674
|
-
{
|
|
675
|
-
"name": "en",
|
|
676
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-once"
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
"name": "zh-cn",
|
|
680
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-once"
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
"name": "ja",
|
|
684
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-once"
|
|
685
|
-
},
|
|
686
|
-
{
|
|
687
|
-
"name": "ua",
|
|
688
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-once"
|
|
689
|
-
},
|
|
690
|
-
{
|
|
691
|
-
"name": "fr",
|
|
692
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-once"
|
|
693
|
-
},
|
|
694
|
-
{
|
|
695
|
-
"name": "ko",
|
|
696
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-once"
|
|
697
|
-
}
|
|
698
|
-
]
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
"name": "v-memo",
|
|
702
|
-
"description": {
|
|
703
|
-
"kind": "markdown",
|
|
704
|
-
"value": "\n- **期望的綁定值類型:**`any[]`\n\n- **詳細信息**\n\n 緩存一個模板的子樹。在元素和組件上都可以使用。為了實現緩存,該指令需要傳入一個固定長度的依賴值數組進行比較。如果數組裡的每個值都與最後一次的渲染相同,那麼整個子樹的更新將被跳過。舉例來說:\n\n ```html\n <div v-memo=\"[valueA, valueB]\">\n ...\n </div>\n ```\n\n 當組件重新渲染,如果 `valueA` 和 `valueB` 都保持不變,這個 `<div>` 及其子項的所有更新都將被跳過。實際上,甚至虛擬 DOM 的 vnode 創建也將被跳過,因為緩存的子樹副本可以被重新使用。\n\n 正確指定緩存數組很重要,否則應該生效的更新可能被跳過。`v-memo` 傳入空依賴數組 (`v-memo=\"[]\"`) 將與 `v-once` 效果相同。\n\n **與 `v-for` 一起使用**\n\n `v-memo` 僅用於性能至上場景中的微小優化,應該很少需要。最常見的情況可能是有助於渲染海量 `v-for` 列表 (長度超過 1000 的情況):\n\n ```html\n <div v-for=\"item in list\" :key=\"item.id\" v-memo=\"[item.id === selected]\">\n <p>ID: {{ item.id }} - selected: {{ item.id === selected }}</p>\n <p>...more child nodes</p>\n </div>\n ```\n\n 當組件的 `selected` 狀態改變,默認會重新創建大量的 vnode,儘管絕大部分都跟之前是一模一樣的。`v-memo` 用在這裡本質上是在說“只有當該項的被選中狀態改變時才需要更新”。這使得每個選中狀態沒有變的項能完全重用之前的 vnode 並跳過差異比較。注意這裡 memo 依賴數組中並不需要包含 `item.id`,因為 Vue 也會根據 item 的 `:key` 進行判斷。\n\n :::warning 警告\n 當搭配 `v-for` 使用 `v-memo`,確保兩者都綁定在同一個元素上。**`v-memo` 不能用在 `v-for` 內部。**\n :::\n\n `v-memo` 也能被用於在一些默認優化失敗的邊際情況下,手動避免子組件出現不需要的更新。但是一樣的,開發者需要負責指定正確的依賴數組以免跳過必要的更新。\n\n- **參考:**\n - [v-once](#v-once)\n"
|
|
705
|
-
},
|
|
706
|
-
"references": [
|
|
707
|
-
{
|
|
708
|
-
"name": "en",
|
|
709
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-memo"
|
|
710
|
-
},
|
|
711
|
-
{
|
|
712
|
-
"name": "zh-cn",
|
|
713
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-memo"
|
|
714
|
-
},
|
|
715
|
-
{
|
|
716
|
-
"name": "ja",
|
|
717
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-memo"
|
|
718
|
-
},
|
|
719
|
-
{
|
|
720
|
-
"name": "ua",
|
|
721
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-memo"
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
"name": "fr",
|
|
725
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-memo"
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
"name": "ko",
|
|
729
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-memo"
|
|
730
|
-
}
|
|
731
|
-
]
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
"name": "v-cloak",
|
|
735
|
-
"description": {
|
|
736
|
-
"kind": "markdown",
|
|
737
|
-
"value": "\n用於隱藏尚未完成編譯的 DOM 模板。\n\n- **無需傳入**\n\n- **詳細信息**\n\n **該指令只在沒有構建步驟的環境下需要使用。**\n\n 當使用直接在 DOM 中書寫的模板時,可能會出現一種叫做“未編譯模板閃現”的情況:用戶可能先看到的是還沒編譯完成的雙大括號標籤,直到掛載的組件將它們替換為實際渲染的內容。\n\n `v-cloak` 會保留在所綁定的元素上,直到相關組件實例被掛載後才移除。配合像 `[v-cloak] { display: none }` 這樣的 CSS 規則,它可以在組件編譯完畢前隱藏原始模板。\n\n- **示例:**\n\n ```css\n [v-cloak] {\n display: none;\n }\n ```\n\n ```html\n <div v-cloak>\n {{ message }}\n </div>\n ```\n\n 直到編譯完成前,`<div>` 將不可見。\n"
|
|
738
|
-
},
|
|
739
|
-
"references": [
|
|
740
|
-
{
|
|
741
|
-
"name": "en",
|
|
742
|
-
"url": "https://vuejs.org/api/built-in-directives.html#v-cloak"
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
"name": "zh-cn",
|
|
746
|
-
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
"name": "ja",
|
|
750
|
-
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
"name": "ua",
|
|
754
|
-
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
755
|
-
},
|
|
756
|
-
{
|
|
757
|
-
"name": "fr",
|
|
758
|
-
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
759
|
-
},
|
|
760
|
-
{
|
|
761
|
-
"name": "ko",
|
|
762
|
-
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
763
|
-
}
|
|
764
|
-
]
|
|
765
|
-
},
|
|
766
|
-
{
|
|
767
|
-
"name": "key",
|
|
768
|
-
"description": {
|
|
769
|
-
"kind": "markdown",
|
|
770
|
-
"value": "\n`key` 這個特殊的 attribute 主要作為 Vue 的虛擬 DOM 算法提示,在比較新舊節點列表時用於識別 vnode。\n\n- **預期**:`number | string | symbol`\n\n- **詳細信息**\n\n 在沒有 key 的情況下,Vue 將使用一種最小化元素移動的算法,並儘可能地就地更新/複用相同類型的元素。如果傳了 key,則將根據 key 的變化順序來重新排列元素,並且將始終移除/銷燬 key 已經不存在的元素。\n\n 同一個父元素下的子元素必須具有**唯一的 key**。重複的 key 將會導致渲染異常。\n\n 最常見的用例是與 `v-for` 結合:\n\n ```html\n <ul>\n <li v-for=\"item in items\" :key=\"item.id\">...</li>\n </ul>\n ```\n\n 也可以用於強制替換一個元素/組件而不是複用它。當你想這麼做時它可能會很有用:\n\n - 在適當的時候觸發組件的生命週期鉤子\n - 觸發過渡\n\n 舉例來說:\n\n ```html\n <transition>\n <span :key=\"text\">{{ text }}</span>\n </transition>\n ```\n\n 當 `text` 變化時,`<span>` 總是會被替換而不是更新,因此 transition 將會被觸發。\n\n- **參考**:[指南- 列表渲染 - 通過 `key` 管理狀態](https://cn.vuejs.org/guide/essentials/list.html#maintaining-state-with-key)\n"
|
|
771
|
-
},
|
|
772
|
-
"references": [
|
|
773
|
-
{
|
|
774
|
-
"name": "en",
|
|
775
|
-
"url": "https://vuejs.org/api/built-in-special-attributes.html#key"
|
|
776
|
-
},
|
|
777
|
-
{
|
|
778
|
-
"name": "zh-cn",
|
|
779
|
-
"url": "https://cn.vuejs.org/api/built-in-special-attributes.html#key"
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
"name": "ja",
|
|
783
|
-
"url": "https://ja.vuejs.org/api/built-in-special-attributes.html#key"
|
|
784
|
-
},
|
|
785
|
-
{
|
|
786
|
-
"name": "ua",
|
|
787
|
-
"url": "https://ua.vuejs.org/api/built-in-special-attributes.html#key"
|
|
788
|
-
},
|
|
789
|
-
{
|
|
790
|
-
"name": "fr",
|
|
791
|
-
"url": "https://fr.vuejs.org/api/built-in-special-attributes.html#key"
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
"name": "ko",
|
|
795
|
-
"url": "https://ko.vuejs.org/api/built-in-special-attributes.html#key"
|
|
796
|
-
}
|
|
797
|
-
]
|
|
798
|
-
},
|
|
799
|
-
{
|
|
800
|
-
"name": "ref",
|
|
801
|
-
"description": {
|
|
802
|
-
"kind": "markdown",
|
|
803
|
-
"value": "\n用於註冊[模板引用](https://cn.vuejs.org/guide/essentials/template-refs.html)。\n\n- **預期**:`string | Function`\n\n- **詳細信息**\n\n `ref` 用於註冊元素或子組件的引用。\n\n 使用選項式 API,引用將被註冊在組件的 `this.$refs` 對象裡:\n\n ```html\n <!-- 存儲為 this.$refs.p -->\n <p ref=\"p\">hello</p>\n ```\n\n 使用組合式 API,引用將存儲在與名字匹配的 ref 裡:\n\n ```vue\n <script setup>\n import { ref } from 'vue'\n\n const p = ref()\n </script>\n\n <template>\n <p ref=\"p\">hello</p>\n </template>\n ```\n\n 如果用於普通 DOM 元素,引用將是元素本身;如果用於子組件,引用將是子組件的實例。\n\n 或者 `ref` 可以接收一個函數值,用於對存儲引用位置的完全控制:\n\n ```html\n <ChildComponent :ref=\"(el) => child = el\" />\n ```\n\n 關於 ref 註冊時機的重要說明:因為 ref 本身是作為渲染函數的結果來創建的,必須等待組件掛載後才能對它進行訪問。\n\n `this.$refs` 也是非響應式的,因此你不應該嘗試在模板中使用它來進行數據綁定。\n\n- **參考:**\n - [指南 - 模板引用](https://cn.vuejs.org/guide/essentials/template-refs.html)\n - [指南 - 為模板引用標註類型](https://cn.vuejs.org/guide/typescript/composition-api.html#typing-template-refs) <sup class=\"vt-badge ts\" />\n - [指南 - 為組件模板引用標註類型](https://cn.vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs) <sup class=\"vt-badge ts\" />\n"
|
|
804
|
-
},
|
|
805
|
-
"references": [
|
|
806
|
-
{
|
|
807
|
-
"name": "en",
|
|
808
|
-
"url": "https://vuejs.org/api/built-in-special-attributes.html#ref"
|
|
809
|
-
},
|
|
810
|
-
{
|
|
811
|
-
"name": "zh-cn",
|
|
812
|
-
"url": "https://cn.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
"name": "ja",
|
|
816
|
-
"url": "https://ja.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
"name": "ua",
|
|
820
|
-
"url": "https://ua.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
821
|
-
},
|
|
822
|
-
{
|
|
823
|
-
"name": "fr",
|
|
824
|
-
"url": "https://fr.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
825
|
-
},
|
|
826
|
-
{
|
|
827
|
-
"name": "ko",
|
|
828
|
-
"url": "https://ko.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
829
|
-
}
|
|
830
|
-
]
|
|
831
|
-
},
|
|
832
|
-
{
|
|
833
|
-
"name": "is",
|
|
834
|
-
"description": {
|
|
835
|
-
"kind": "markdown",
|
|
836
|
-
"value": "\n用於綁定[動態組件](https://cn.vuejs.org/guide/essentials/component-basics.html#dynamic-components)。\n\n- **預期**:`string | Component`\n\n- **用於原生元素** <sup class=\"vt-badge\">3.1+</sup>\n\n 當 `is` attribute 用於原生 HTML 元素時,它將被當作 [Customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-customized-builtin-example),其為原生 web 平臺的特性。\n\n 但是,在這種用例中,你可能需要 Vue 用其組件來替換原生元素,如 [DOM 模板解析注意事項](https://cn.vuejs.org/guide/essentials/component-basics.html#dom-template-parsing-caveats)所述。你可以在 `is` attribute 的值中加上 `vue:` 前綴,這樣 Vue 就會把該元素渲染為 Vue 組件:\n\n ```html\n <table>\n <tr is=\"vue:my-row-component\"></tr>\n </table>\n ```\n\n- **參考:**\n\n - [內置特殊元素 - `<component>`](https://cn.vuejs.org/api/built-in-special-elements.html#component)\n - [動態組件](https://cn.vuejs.org/guide/essentials/component-basics.html#dynamic-components)\n"
|
|
837
|
-
},
|
|
838
|
-
"references": [
|
|
839
|
-
{
|
|
840
|
-
"name": "en",
|
|
841
|
-
"url": "https://vuejs.org/api/built-in-special-attributes.html#is"
|
|
842
|
-
},
|
|
843
|
-
{
|
|
844
|
-
"name": "zh-cn",
|
|
845
|
-
"url": "https://cn.vuejs.org/api/built-in-special-attributes.html#is"
|
|
846
|
-
},
|
|
847
|
-
{
|
|
848
|
-
"name": "ja",
|
|
849
|
-
"url": "https://ja.vuejs.org/api/built-in-special-attributes.html#is"
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
"name": "ua",
|
|
853
|
-
"url": "https://ua.vuejs.org/api/built-in-special-attributes.html#is"
|
|
854
|
-
},
|
|
855
|
-
{
|
|
856
|
-
"name": "fr",
|
|
857
|
-
"url": "https://fr.vuejs.org/api/built-in-special-attributes.html#is"
|
|
858
|
-
},
|
|
859
|
-
{
|
|
860
|
-
"name": "ko",
|
|
861
|
-
"url": "https://ko.vuejs.org/api/built-in-special-attributes.html#is"
|
|
862
|
-
}
|
|
863
|
-
]
|
|
864
|
-
}
|
|
865
|
-
]
|
|
866
|
-
}
|