@vue/language-service 2.0.19 → 2.0.20
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/language-blocks/cs.json +69 -1
- package/data/language-blocks/en.json +69 -1
- package/data/language-blocks/fr.json +69 -1
- package/data/language-blocks/it.json +68 -0
- package/data/language-blocks/ja.json +69 -1
- package/data/language-blocks/ko.json +70 -2
- package/data/language-blocks/pt.json +68 -0
- package/data/language-blocks/ru.json +69 -1
- package/data/language-blocks/zh-cn.json +69 -1
- package/data/language-blocks/zh-hk.json +1102 -0
- package/data/model-modifiers/cs.json +12 -0
- package/data/model-modifiers/en.json +12 -0
- package/data/model-modifiers/fr.json +12 -0
- package/data/model-modifiers/it.json +12 -0
- package/data/model-modifiers/ja.json +12 -0
- package/data/model-modifiers/ko.json +12 -0
- package/data/model-modifiers/pt.json +12 -0
- package/data/model-modifiers/ru.json +12 -0
- package/data/model-modifiers/zh-cn.json +12 -0
- package/data/model-modifiers/zh-hk.json +188 -0
- package/data/template/cs.json +104 -0
- package/data/template/en.json +104 -0
- package/data/template/fr.json +104 -0
- package/data/template/it.json +104 -0
- package/data/template/ja.json +104 -0
- package/data/template/ko.json +105 -1
- package/data/template/pt.json +104 -0
- package/data/template/ru.json +104 -0
- package/data/template/zh-cn.json +104 -0
- package/data/template/zh-hk.json +1602 -0
- package/index.d.ts +3 -3
- package/index.js +8 -9
- package/lib/ideFeatures/nameCasing.d.ts +6 -5
- package/lib/ideFeatures/nameCasing.js +2 -2
- package/lib/plugins/css.js +2 -2
- package/lib/plugins/data.js +9 -0
- package/lib/plugins/vue-autoinsert-dotvalue.d.ts +2 -2
- package/lib/plugins/vue-autoinsert-dotvalue.js +17 -7
- package/lib/plugins/vue-autoinsert-space.js +7 -1
- package/lib/plugins/vue-codelens-references.d.ts +2 -0
- package/lib/plugins/vue-codelens-references.js +42 -0
- package/lib/plugins/vue-directive-comments.js +5 -1
- package/lib/plugins/vue-document-drop.d.ts +2 -2
- package/lib/plugins/vue-document-drop.js +12 -6
- package/lib/plugins/vue-document-links.js +6 -3
- package/lib/plugins/vue-extract-file.d.ts +2 -2
- package/lib/plugins/vue-extract-file.js +11 -4
- package/lib/plugins/vue-sfc.js +4 -3
- package/lib/plugins/vue-template.d.ts +2 -2
- package/lib/plugins/vue-template.js +155 -132
- package/lib/plugins/vue-toggle-v-bind-codeaction.js +7 -1
- package/lib/plugins/vue-twoslash-queries.d.ts +2 -2
- package/lib/plugins/vue-twoslash-queries.js +6 -2
- package/lib/plugins/vue-visualize-hidden-callback-param.js +5 -1
- package/package.json +16 -16
- package/scripts/update-html-data.js +6 -0
|
@@ -0,0 +1,1602 @@
|
|
|
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://zh-hk.vuejs.org/guide/built-ins/transition.html)\n"
|
|
9
|
+
},
|
|
10
|
+
"attributes": [],
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"name": "en",
|
|
14
|
+
"url": "https://vuejs.org/api/built-in-components.html#transition"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "zh-cn",
|
|
18
|
+
"url": "https://cn.vuejs.org/api/built-in-components.html#transition"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "zh-hk",
|
|
22
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-components.html#transition"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "ja",
|
|
26
|
+
"url": "https://ja.vuejs.org/api/built-in-components.html#transition"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "ua",
|
|
30
|
+
"url": "https://ua.vuejs.org/api/built-in-components.html#transition"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "fr",
|
|
34
|
+
"url": "https://fr.vuejs.org/api/built-in-components.html#transition"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "ko",
|
|
38
|
+
"url": "https://ko.vuejs.org/api/built-in-components.html#transition"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "pt",
|
|
42
|
+
"url": "https://pt.vuejs.org/api/built-in-components.html#transition"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "bn",
|
|
46
|
+
"url": "https://bn.vuejs.org/api/built-in-components.html#transition"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "it",
|
|
50
|
+
"url": "https://it.vuejs.org/api/built-in-components.html#transition"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "cs",
|
|
54
|
+
"url": "https://cs.vuejs.org/api/built-in-components.html#transition"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "ru",
|
|
58
|
+
"url": "https://ru.vuejs.org/api/built-in-components.html#transition"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "fa",
|
|
62
|
+
"url": "https://fa.vuejs.org/api/built-in-components.html#transition"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "TransitionGroup",
|
|
68
|
+
"description": {
|
|
69
|
+
"kind": "markdown",
|
|
70
|
+
"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://zh-hk.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://zh-hk.vuejs.org/guide/built-ins/transition-group.html)\n"
|
|
71
|
+
},
|
|
72
|
+
"attributes": [],
|
|
73
|
+
"references": [
|
|
74
|
+
{
|
|
75
|
+
"name": "en",
|
|
76
|
+
"url": "https://vuejs.org/api/built-in-components.html#transitiongroup"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "zh-cn",
|
|
80
|
+
"url": "https://cn.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "zh-hk",
|
|
84
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "ja",
|
|
88
|
+
"url": "https://ja.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "ua",
|
|
92
|
+
"url": "https://ua.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "fr",
|
|
96
|
+
"url": "https://fr.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "ko",
|
|
100
|
+
"url": "https://ko.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "pt",
|
|
104
|
+
"url": "https://pt.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "bn",
|
|
108
|
+
"url": "https://bn.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "it",
|
|
112
|
+
"url": "https://it.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "cs",
|
|
116
|
+
"url": "https://cs.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "ru",
|
|
120
|
+
"url": "https://ru.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "fa",
|
|
124
|
+
"url": "https://fa.vuejs.org/api/built-in-components.html#transitiongroup"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "KeepAlive",
|
|
130
|
+
"description": {
|
|
131
|
+
"kind": "markdown",
|
|
132
|
+
"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://zh-hk.vuejs.org/guide/built-ins/keep-alive.html)\n"
|
|
133
|
+
},
|
|
134
|
+
"attributes": [],
|
|
135
|
+
"references": [
|
|
136
|
+
{
|
|
137
|
+
"name": "en",
|
|
138
|
+
"url": "https://vuejs.org/api/built-in-components.html#keepalive"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "zh-cn",
|
|
142
|
+
"url": "https://cn.vuejs.org/api/built-in-components.html#keepalive"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "zh-hk",
|
|
146
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-components.html#keepalive"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "ja",
|
|
150
|
+
"url": "https://ja.vuejs.org/api/built-in-components.html#keepalive"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "ua",
|
|
154
|
+
"url": "https://ua.vuejs.org/api/built-in-components.html#keepalive"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "fr",
|
|
158
|
+
"url": "https://fr.vuejs.org/api/built-in-components.html#keepalive"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "ko",
|
|
162
|
+
"url": "https://ko.vuejs.org/api/built-in-components.html#keepalive"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "pt",
|
|
166
|
+
"url": "https://pt.vuejs.org/api/built-in-components.html#keepalive"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "bn",
|
|
170
|
+
"url": "https://bn.vuejs.org/api/built-in-components.html#keepalive"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "it",
|
|
174
|
+
"url": "https://it.vuejs.org/api/built-in-components.html#keepalive"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "cs",
|
|
178
|
+
"url": "https://cs.vuejs.org/api/built-in-components.html#keepalive"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "ru",
|
|
182
|
+
"url": "https://ru.vuejs.org/api/built-in-components.html#keepalive"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "fa",
|
|
186
|
+
"url": "https://fa.vuejs.org/api/built-in-components.html#keepalive"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "Teleport",
|
|
192
|
+
"description": {
|
|
193
|
+
"kind": "markdown",
|
|
194
|
+
"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://zh-hk.vuejs.org/guide/built-ins/teleport.html)\n"
|
|
195
|
+
},
|
|
196
|
+
"attributes": [],
|
|
197
|
+
"references": [
|
|
198
|
+
{
|
|
199
|
+
"name": "en",
|
|
200
|
+
"url": "https://vuejs.org/api/built-in-components.html#teleport"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "zh-cn",
|
|
204
|
+
"url": "https://cn.vuejs.org/api/built-in-components.html#teleport"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"name": "zh-hk",
|
|
208
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-components.html#teleport"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "ja",
|
|
212
|
+
"url": "https://ja.vuejs.org/api/built-in-components.html#teleport"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"name": "ua",
|
|
216
|
+
"url": "https://ua.vuejs.org/api/built-in-components.html#teleport"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "fr",
|
|
220
|
+
"url": "https://fr.vuejs.org/api/built-in-components.html#teleport"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "ko",
|
|
224
|
+
"url": "https://ko.vuejs.org/api/built-in-components.html#teleport"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "pt",
|
|
228
|
+
"url": "https://pt.vuejs.org/api/built-in-components.html#teleport"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "bn",
|
|
232
|
+
"url": "https://bn.vuejs.org/api/built-in-components.html#teleport"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "it",
|
|
236
|
+
"url": "https://it.vuejs.org/api/built-in-components.html#teleport"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "cs",
|
|
240
|
+
"url": "https://cs.vuejs.org/api/built-in-components.html#teleport"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "ru",
|
|
244
|
+
"url": "https://ru.vuejs.org/api/built-in-components.html#teleport"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "fa",
|
|
248
|
+
"url": "https://fa.vuejs.org/api/built-in-components.html#teleport"
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "Suspense",
|
|
254
|
+
"description": {
|
|
255
|
+
"kind": "markdown",
|
|
256
|
+
"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://zh-hk.vuejs.org/guide/components/async.html)和具有 [`async setup()`](https://zh-hk.vuejs.org/guide/built-ins/suspense.html#async-setup) 的组件),它将等到所有异步依赖项解析完成时再显示默认插槽。\n\n- **参考**[指南 - Suspense](https://zh-hk.vuejs.org/guide/built-ins/suspense.html)\n"
|
|
257
|
+
},
|
|
258
|
+
"attributes": [],
|
|
259
|
+
"references": [
|
|
260
|
+
{
|
|
261
|
+
"name": "en",
|
|
262
|
+
"url": "https://vuejs.org/api/built-in-components.html#suspense"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "zh-cn",
|
|
266
|
+
"url": "https://cn.vuejs.org/api/built-in-components.html#suspense"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"name": "zh-hk",
|
|
270
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-components.html#suspense"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "ja",
|
|
274
|
+
"url": "https://ja.vuejs.org/api/built-in-components.html#suspense"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "ua",
|
|
278
|
+
"url": "https://ua.vuejs.org/api/built-in-components.html#suspense"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": "fr",
|
|
282
|
+
"url": "https://fr.vuejs.org/api/built-in-components.html#suspense"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"name": "ko",
|
|
286
|
+
"url": "https://ko.vuejs.org/api/built-in-components.html#suspense"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "pt",
|
|
290
|
+
"url": "https://pt.vuejs.org/api/built-in-components.html#suspense"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "bn",
|
|
294
|
+
"url": "https://bn.vuejs.org/api/built-in-components.html#suspense"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "it",
|
|
298
|
+
"url": "https://it.vuejs.org/api/built-in-components.html#suspense"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"name": "cs",
|
|
302
|
+
"url": "https://cs.vuejs.org/api/built-in-components.html#suspense"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"name": "ru",
|
|
306
|
+
"url": "https://ru.vuejs.org/api/built-in-components.html#suspense"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "fa",
|
|
310
|
+
"url": "https://fa.vuejs.org/api/built-in-components.html#suspense"
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "component",
|
|
316
|
+
"description": {
|
|
317
|
+
"kind": "markdown",
|
|
318
|
+
"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://zh-hk.vuejs.org/guide/essentials/component-basics.html#dynamic-components)\n"
|
|
319
|
+
},
|
|
320
|
+
"attributes": [],
|
|
321
|
+
"references": [
|
|
322
|
+
{
|
|
323
|
+
"name": "en",
|
|
324
|
+
"url": "https://vuejs.org/api/built-in-special-elements.html#component"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"name": "zh-cn",
|
|
328
|
+
"url": "https://cn.vuejs.org/api/built-in-special-elements.html#component"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"name": "zh-hk",
|
|
332
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-special-elements.html#component"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "ja",
|
|
336
|
+
"url": "https://ja.vuejs.org/api/built-in-special-elements.html#component"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "ua",
|
|
340
|
+
"url": "https://ua.vuejs.org/api/built-in-special-elements.html#component"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "fr",
|
|
344
|
+
"url": "https://fr.vuejs.org/api/built-in-special-elements.html#component"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "ko",
|
|
348
|
+
"url": "https://ko.vuejs.org/api/built-in-special-elements.html#component"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"name": "pt",
|
|
352
|
+
"url": "https://pt.vuejs.org/api/built-in-special-elements.html#component"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"name": "bn",
|
|
356
|
+
"url": "https://bn.vuejs.org/api/built-in-special-elements.html#component"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"name": "it",
|
|
360
|
+
"url": "https://it.vuejs.org/api/built-in-special-elements.html#component"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"name": "cs",
|
|
364
|
+
"url": "https://cs.vuejs.org/api/built-in-special-elements.html#component"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "ru",
|
|
368
|
+
"url": "https://ru.vuejs.org/api/built-in-special-elements.html#component"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"name": "fa",
|
|
372
|
+
"url": "https://fa.vuejs.org/api/built-in-special-elements.html#component"
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"name": "slot",
|
|
378
|
+
"description": {
|
|
379
|
+
"kind": "markdown",
|
|
380
|
+
"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://zh-hk.vuejs.org/guide/components/slots.html)\n"
|
|
381
|
+
},
|
|
382
|
+
"attributes": [],
|
|
383
|
+
"references": [
|
|
384
|
+
{
|
|
385
|
+
"name": "en",
|
|
386
|
+
"url": "https://vuejs.org/api/built-in-special-elements.html#slot"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "zh-cn",
|
|
390
|
+
"url": "https://cn.vuejs.org/api/built-in-special-elements.html#slot"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "zh-hk",
|
|
394
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-special-elements.html#slot"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"name": "ja",
|
|
398
|
+
"url": "https://ja.vuejs.org/api/built-in-special-elements.html#slot"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"name": "ua",
|
|
402
|
+
"url": "https://ua.vuejs.org/api/built-in-special-elements.html#slot"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"name": "fr",
|
|
406
|
+
"url": "https://fr.vuejs.org/api/built-in-special-elements.html#slot"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"name": "ko",
|
|
410
|
+
"url": "https://ko.vuejs.org/api/built-in-special-elements.html#slot"
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "pt",
|
|
414
|
+
"url": "https://pt.vuejs.org/api/built-in-special-elements.html#slot"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"name": "bn",
|
|
418
|
+
"url": "https://bn.vuejs.org/api/built-in-special-elements.html#slot"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"name": "it",
|
|
422
|
+
"url": "https://it.vuejs.org/api/built-in-special-elements.html#slot"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"name": "cs",
|
|
426
|
+
"url": "https://cs.vuejs.org/api/built-in-special-elements.html#slot"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"name": "ru",
|
|
430
|
+
"url": "https://ru.vuejs.org/api/built-in-special-elements.html#slot"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "fa",
|
|
434
|
+
"url": "https://fa.vuejs.org/api/built-in-special-elements.html#slot"
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "template",
|
|
440
|
+
"description": {
|
|
441
|
+
"kind": "markdown",
|
|
442
|
+
"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://zh-hk.vuejs.org/api/built-in-special-attributes.html#key)。所有其他的属性和指令都将被丢弃,因为没有相应的元素,它们就没有意义。\n\n 单文件组件使用[顶层的 `<template>` 标签](https://zh-hk.vuejs.org/api/sfc-spec.html#language-blocks)来包裹整个模板。这种用法与上面描述的 `<template>` 使用方式是有区别的。该顶层标签不是模板本身的一部分,不支持指令等模板语法。\n\n- **参考**\n - [指南 - `<template>` 上的 `v-if`](https://zh-hk.vuejs.org/guide/essentials/conditional.html#v-if-on-template)\n - [指南 - `<template>` 上的 `v-for`](https://zh-hk.vuejs.org/guide/essentials/list.html#v-for-on-template)\n - [指南 - 具名插槽](https://zh-hk.vuejs.org/guide/components/slots.html#named-slots)\n"
|
|
443
|
+
},
|
|
444
|
+
"attributes": [],
|
|
445
|
+
"references": [
|
|
446
|
+
{
|
|
447
|
+
"name": "en",
|
|
448
|
+
"url": "https://vuejs.org/api/built-in-special-elements.html#template"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"name": "zh-cn",
|
|
452
|
+
"url": "https://cn.vuejs.org/api/built-in-special-elements.html#template"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"name": "zh-hk",
|
|
456
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-special-elements.html#template"
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"name": "ja",
|
|
460
|
+
"url": "https://ja.vuejs.org/api/built-in-special-elements.html#template"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "ua",
|
|
464
|
+
"url": "https://ua.vuejs.org/api/built-in-special-elements.html#template"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"name": "fr",
|
|
468
|
+
"url": "https://fr.vuejs.org/api/built-in-special-elements.html#template"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"name": "ko",
|
|
472
|
+
"url": "https://ko.vuejs.org/api/built-in-special-elements.html#template"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"name": "pt",
|
|
476
|
+
"url": "https://pt.vuejs.org/api/built-in-special-elements.html#template"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"name": "bn",
|
|
480
|
+
"url": "https://bn.vuejs.org/api/built-in-special-elements.html#template"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"name": "it",
|
|
484
|
+
"url": "https://it.vuejs.org/api/built-in-special-elements.html#template"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"name": "cs",
|
|
488
|
+
"url": "https://cs.vuejs.org/api/built-in-special-elements.html#template"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"name": "ru",
|
|
492
|
+
"url": "https://ru.vuejs.org/api/built-in-special-elements.html#template"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"name": "fa",
|
|
496
|
+
"url": "https://fa.vuejs.org/api/built-in-special-elements.html#template"
|
|
497
|
+
}
|
|
498
|
+
]
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
"globalAttributes": [
|
|
502
|
+
{
|
|
503
|
+
"name": "v-text",
|
|
504
|
+
"description": {
|
|
505
|
+
"kind": "markdown",
|
|
506
|
+
"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://zh-hk.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://zh-hk.vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n"
|
|
507
|
+
},
|
|
508
|
+
"references": [
|
|
509
|
+
{
|
|
510
|
+
"name": "en",
|
|
511
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-text"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"name": "zh-cn",
|
|
515
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-text"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"name": "zh-hk",
|
|
519
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-text"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"name": "ja",
|
|
523
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-text"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"name": "ua",
|
|
527
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-text"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"name": "fr",
|
|
531
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-text"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"name": "ko",
|
|
535
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-text"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"name": "pt",
|
|
539
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-text"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"name": "bn",
|
|
543
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-text"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"name": "it",
|
|
547
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-text"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"name": "cs",
|
|
551
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-text"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"name": "ru",
|
|
555
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-text"
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"name": "fa",
|
|
559
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-text"
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"name": "v-html",
|
|
565
|
+
"description": {
|
|
566
|
+
"kind": "markdown",
|
|
567
|
+
"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://zh-hk.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://zh-hk.vuejs.org/guide/essentials/template-syntax.html#raw-html)\n"
|
|
568
|
+
},
|
|
569
|
+
"references": [
|
|
570
|
+
{
|
|
571
|
+
"name": "en",
|
|
572
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-html"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"name": "zh-cn",
|
|
576
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-html"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"name": "zh-hk",
|
|
580
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-html"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"name": "ja",
|
|
584
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-html"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"name": "ua",
|
|
588
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-html"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"name": "fr",
|
|
592
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-html"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"name": "ko",
|
|
596
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-html"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"name": "pt",
|
|
600
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-html"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"name": "bn",
|
|
604
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-html"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"name": "it",
|
|
608
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-html"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"name": "cs",
|
|
612
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-html"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"name": "ru",
|
|
616
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-html"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"name": "fa",
|
|
620
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-html"
|
|
621
|
+
}
|
|
622
|
+
]
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"name": "v-show",
|
|
626
|
+
"description": {
|
|
627
|
+
"kind": "markdown",
|
|
628
|
+
"value": "\n基于表达式值的真假性,来改变元素的可见性。\n\n- **期望的绑定值类型:**`any`\n\n- **详细信息**\n\n `v-show` 通过设置内联样式的 `display` CSS 属性来工作,当元素可见时将使用初始 `display` 值。当条件改变时,也会触发过渡效果。\n\n- **参考**[条件渲染 - v-show](https://zh-hk.vuejs.org/guide/essentials/conditional.html#v-show)\n"
|
|
629
|
+
},
|
|
630
|
+
"references": [
|
|
631
|
+
{
|
|
632
|
+
"name": "en",
|
|
633
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-show"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"name": "zh-cn",
|
|
637
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-show"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"name": "zh-hk",
|
|
641
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-show"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"name": "ja",
|
|
645
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-show"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"name": "ua",
|
|
649
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-show"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"name": "fr",
|
|
653
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-show"
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
"name": "ko",
|
|
657
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-show"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"name": "pt",
|
|
661
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-show"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"name": "bn",
|
|
665
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-show"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
"name": "it",
|
|
669
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-show"
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
"name": "cs",
|
|
673
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-show"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"name": "ru",
|
|
677
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-show"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"name": "fa",
|
|
681
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-show"
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"name": "v-if",
|
|
687
|
+
"description": {
|
|
688
|
+
"kind": "markdown",
|
|
689
|
+
"value": "\n基于表达式值的真假性,来条件性地渲染元素或者模板片段。\n\n- **期望的绑定值类型:**`any`\n\n- **详细信息**\n\n 当 `v-if` 元素被触发,元素及其所包含的指令/组件都会销毁和重构。如果初始条件是假,那么其内部的内容根本都不会被渲染。\n\n 可用于 `<template>` 表示仅包含文本或多个元素的条件块。\n\n 当条件改变时会触发过渡效果。\n\n 当同时使用时,`v-if` 比 `v-for` 优先级更高。我们并不推荐在一元素上同时使用这两个指令 — 查看[列表渲染指南](https://zh-hk.vuejs.org/guide/essentials/list.html#v-for-with-v-if)详情。\n\n- **参考**[条件渲染 - v-if](https://zh-hk.vuejs.org/guide/essentials/conditional.html#v-if)\n"
|
|
690
|
+
},
|
|
691
|
+
"references": [
|
|
692
|
+
{
|
|
693
|
+
"name": "en",
|
|
694
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-if"
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
"name": "zh-cn",
|
|
698
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-if"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"name": "zh-hk",
|
|
702
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-if"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"name": "ja",
|
|
706
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-if"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"name": "ua",
|
|
710
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-if"
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
"name": "fr",
|
|
714
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-if"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
"name": "ko",
|
|
718
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-if"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"name": "pt",
|
|
722
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-if"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "bn",
|
|
726
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-if"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"name": "it",
|
|
730
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-if"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"name": "cs",
|
|
734
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-if"
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"name": "ru",
|
|
738
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-if"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"name": "fa",
|
|
742
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-if"
|
|
743
|
+
}
|
|
744
|
+
]
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"name": "v-else",
|
|
748
|
+
"valueSet": "v",
|
|
749
|
+
"description": {
|
|
750
|
+
"kind": "markdown",
|
|
751
|
+
"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://zh-hk.vuejs.org/guide/essentials/conditional.html#v-else)\n"
|
|
752
|
+
},
|
|
753
|
+
"references": [
|
|
754
|
+
{
|
|
755
|
+
"name": "en",
|
|
756
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-else"
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"name": "zh-cn",
|
|
760
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-else"
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
"name": "zh-hk",
|
|
764
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-else"
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"name": "ja",
|
|
768
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-else"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
"name": "ua",
|
|
772
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-else"
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
"name": "fr",
|
|
776
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-else"
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
"name": "ko",
|
|
780
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-else"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
"name": "pt",
|
|
784
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-else"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
"name": "bn",
|
|
788
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-else"
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
"name": "it",
|
|
792
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-else"
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"name": "cs",
|
|
796
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-else"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"name": "ru",
|
|
800
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-else"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"name": "fa",
|
|
804
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-else"
|
|
805
|
+
}
|
|
806
|
+
]
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
"name": "v-else-if",
|
|
810
|
+
"description": {
|
|
811
|
+
"kind": "markdown",
|
|
812
|
+
"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://zh-hk.vuejs.org/guide/essentials/conditional.html#v-else-if)\n"
|
|
813
|
+
},
|
|
814
|
+
"references": [
|
|
815
|
+
{
|
|
816
|
+
"name": "en",
|
|
817
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-else-if"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"name": "zh-cn",
|
|
821
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"name": "zh-hk",
|
|
825
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"name": "ja",
|
|
829
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
"name": "ua",
|
|
833
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
"name": "fr",
|
|
837
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"name": "ko",
|
|
841
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"name": "pt",
|
|
845
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"name": "bn",
|
|
849
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"name": "it",
|
|
853
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"name": "cs",
|
|
857
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"name": "ru",
|
|
861
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"name": "fa",
|
|
865
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-else-if"
|
|
866
|
+
}
|
|
867
|
+
]
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"name": "v-for",
|
|
871
|
+
"description": {
|
|
872
|
+
"kind": "markdown",
|
|
873
|
+
"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://zh-hk.vuejs.org/guide/essentials/list.html)\n"
|
|
874
|
+
},
|
|
875
|
+
"references": [
|
|
876
|
+
{
|
|
877
|
+
"name": "en",
|
|
878
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-for"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
"name": "zh-cn",
|
|
882
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-for"
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"name": "zh-hk",
|
|
886
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-for"
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"name": "ja",
|
|
890
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-for"
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
"name": "ua",
|
|
894
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-for"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
"name": "fr",
|
|
898
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-for"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
"name": "ko",
|
|
902
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-for"
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
"name": "pt",
|
|
906
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-for"
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"name": "bn",
|
|
910
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-for"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"name": "it",
|
|
914
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-for"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
"name": "cs",
|
|
918
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-for"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"name": "ru",
|
|
922
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-for"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"name": "fa",
|
|
926
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-for"
|
|
927
|
+
}
|
|
928
|
+
]
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"name": "v-on",
|
|
932
|
+
"description": {
|
|
933
|
+
"kind": "markdown",
|
|
934
|
+
"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://zh-hk.vuejs.org/guide/essentials/event-handling.html)\n - [组件 - 自定义事件](https://zh-hk.vuejs.org/guide/essentials/component-basics.html#listening-to-events)\n"
|
|
935
|
+
},
|
|
936
|
+
"references": [
|
|
937
|
+
{
|
|
938
|
+
"name": "en",
|
|
939
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-on"
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
"name": "zh-cn",
|
|
943
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-on"
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
"name": "zh-hk",
|
|
947
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-on"
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
"name": "ja",
|
|
951
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-on"
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"name": "ua",
|
|
955
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-on"
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
"name": "fr",
|
|
959
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-on"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
"name": "ko",
|
|
963
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-on"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
"name": "pt",
|
|
967
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-on"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
"name": "bn",
|
|
971
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-on"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
"name": "it",
|
|
975
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-on"
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
"name": "cs",
|
|
979
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-on"
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
"name": "ru",
|
|
983
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-on"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
"name": "fa",
|
|
987
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-on"
|
|
988
|
+
}
|
|
989
|
+
]
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"name": "v-bind",
|
|
993
|
+
"description": {
|
|
994
|
+
"kind": "markdown",
|
|
995
|
+
"value": "\n动态的绑定一个或多个 attribute,也可以是组件的 prop。\n\n- **缩写:**\n - `:` 或者 `.` (当使用 `.prop` 修饰符)\n - 值可以省略 (当 attribute 和绑定的值同名时) <sup class=\"vt-badge\">3.4+</sup>\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://zh-hk.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 名 (3.4+),扩展为 :src=\"src\" -->\n <img :src />\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://zh-hk.vuejs.org/guide/essentials/class-and-style.html)\n - [组件 - Prop 传递细节](https://zh-hk.vuejs.org/guide/components/props.html#prop-passing-details)\n"
|
|
996
|
+
},
|
|
997
|
+
"references": [
|
|
998
|
+
{
|
|
999
|
+
"name": "en",
|
|
1000
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-bind"
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
"name": "zh-cn",
|
|
1004
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
"name": "zh-hk",
|
|
1008
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
"name": "ja",
|
|
1012
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
"name": "ua",
|
|
1016
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
"name": "fr",
|
|
1020
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"name": "ko",
|
|
1024
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
"name": "pt",
|
|
1028
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
"name": "bn",
|
|
1032
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
"name": "it",
|
|
1036
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
"name": "cs",
|
|
1040
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
"name": "ru",
|
|
1044
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
"name": "fa",
|
|
1048
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-bind"
|
|
1049
|
+
}
|
|
1050
|
+
]
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"name": "v-model",
|
|
1054
|
+
"description": {
|
|
1055
|
+
"kind": "markdown",
|
|
1056
|
+
"value": "\n在表单输入元素或组件上创建双向绑定。\n\n- **期望的绑定值类型**:根据表单输入元素或组件输出的值而变化\n\n- **仅限:**\n\n - `<input>`\n - `<select>`\n - `<textarea>`\n - components\n\n- **修饰符**\n\n - [`.lazy`](https://zh-hk.vuejs.org/guide/essentials/forms.html#lazy) - 监听 `change` 事件而不是 `input`\n - [`.number`](https://zh-hk.vuejs.org/guide/essentials/forms.html#number) - 将输入的合法字符串转为数字\n - [`.trim`](https://zh-hk.vuejs.org/guide/essentials/forms.html#trim) - 移除输入内容两端空格\n\n- **参考**\n\n - [表单输入绑定](https://zh-hk.vuejs.org/guide/essentials/forms.html)\n - [组件事件 - 配合 `v-model` 使用](https://zh-hk.vuejs.org/guide/components/v-model.html)\n"
|
|
1057
|
+
},
|
|
1058
|
+
"references": [
|
|
1059
|
+
{
|
|
1060
|
+
"name": "en",
|
|
1061
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-model"
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
"name": "zh-cn",
|
|
1065
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-model"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
"name": "zh-hk",
|
|
1069
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-model"
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
"name": "ja",
|
|
1073
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-model"
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
"name": "ua",
|
|
1077
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-model"
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
"name": "fr",
|
|
1081
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-model"
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
"name": "ko",
|
|
1085
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-model"
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
"name": "pt",
|
|
1089
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-model"
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
"name": "bn",
|
|
1093
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-model"
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
"name": "it",
|
|
1097
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-model"
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
"name": "cs",
|
|
1101
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-model"
|
|
1102
|
+
},
|
|
1103
|
+
{
|
|
1104
|
+
"name": "ru",
|
|
1105
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-model"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
"name": "fa",
|
|
1109
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-model"
|
|
1110
|
+
}
|
|
1111
|
+
]
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
"name": "v-slot",
|
|
1115
|
+
"description": {
|
|
1116
|
+
"kind": "markdown",
|
|
1117
|
+
"value": "\n用于声明具名插槽或是期望接收 props 的作用域插槽。\n\n- **缩写:**`#`\n\n- **期望的绑定值类型**:能够合法在函数参数位置使用的 JavaScript 表达式。支持解构语法。绑定值是可选的——只有在给作用域插槽传递 props 才需要。\n\n- **参数**:插槽名 (可选,默认是 `default`)\n\n- **仅限:**\n\n - `<template>`\n - [components](https://zh-hk.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://zh-hk.vuejs.org/guide/components/slots.html)\n"
|
|
1118
|
+
},
|
|
1119
|
+
"references": [
|
|
1120
|
+
{
|
|
1121
|
+
"name": "en",
|
|
1122
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-slot"
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
"name": "zh-cn",
|
|
1126
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
"name": "zh-hk",
|
|
1130
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1131
|
+
},
|
|
1132
|
+
{
|
|
1133
|
+
"name": "ja",
|
|
1134
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"name": "ua",
|
|
1138
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"name": "fr",
|
|
1142
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
"name": "ko",
|
|
1146
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
"name": "pt",
|
|
1150
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
"name": "bn",
|
|
1154
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"name": "it",
|
|
1158
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
"name": "cs",
|
|
1162
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
"name": "ru",
|
|
1166
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
"name": "fa",
|
|
1170
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-slot"
|
|
1171
|
+
}
|
|
1172
|
+
]
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
"name": "v-pre",
|
|
1176
|
+
"description": {
|
|
1177
|
+
"kind": "markdown",
|
|
1178
|
+
"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"
|
|
1179
|
+
},
|
|
1180
|
+
"references": [
|
|
1181
|
+
{
|
|
1182
|
+
"name": "en",
|
|
1183
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-pre"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"name": "zh-cn",
|
|
1187
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
"name": "zh-hk",
|
|
1191
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
"name": "ja",
|
|
1195
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
"name": "ua",
|
|
1199
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"name": "fr",
|
|
1203
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
"name": "ko",
|
|
1207
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
"name": "pt",
|
|
1211
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
"name": "bn",
|
|
1215
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
"name": "it",
|
|
1219
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
"name": "cs",
|
|
1223
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
"name": "ru",
|
|
1227
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
"name": "fa",
|
|
1231
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-pre"
|
|
1232
|
+
}
|
|
1233
|
+
]
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
"name": "v-once",
|
|
1237
|
+
"description": {
|
|
1238
|
+
"kind": "markdown",
|
|
1239
|
+
"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://zh-hk.vuejs.org/guide/essentials/template-syntax.html#text-interpolation)\n - [v-memo](#v-memo)\n"
|
|
1240
|
+
},
|
|
1241
|
+
"references": [
|
|
1242
|
+
{
|
|
1243
|
+
"name": "en",
|
|
1244
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-once"
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
"name": "zh-cn",
|
|
1248
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-once"
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
"name": "zh-hk",
|
|
1252
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-once"
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
"name": "ja",
|
|
1256
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-once"
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
"name": "ua",
|
|
1260
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-once"
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
"name": "fr",
|
|
1264
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-once"
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
"name": "ko",
|
|
1268
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-once"
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
"name": "pt",
|
|
1272
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-once"
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
"name": "bn",
|
|
1276
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-once"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
"name": "it",
|
|
1280
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-once"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"name": "cs",
|
|
1284
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-once"
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
"name": "ru",
|
|
1288
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-once"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
"name": "fa",
|
|
1292
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-once"
|
|
1293
|
+
}
|
|
1294
|
+
]
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
"name": "v-memo",
|
|
1298
|
+
"description": {
|
|
1299
|
+
"kind": "markdown",
|
|
1300
|
+
"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"
|
|
1301
|
+
},
|
|
1302
|
+
"references": [
|
|
1303
|
+
{
|
|
1304
|
+
"name": "en",
|
|
1305
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-memo"
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
"name": "zh-cn",
|
|
1309
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
"name": "zh-hk",
|
|
1313
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
"name": "ja",
|
|
1317
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
"name": "ua",
|
|
1321
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
"name": "fr",
|
|
1325
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"name": "ko",
|
|
1329
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
"name": "pt",
|
|
1333
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
"name": "bn",
|
|
1337
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
"name": "it",
|
|
1341
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
"name": "cs",
|
|
1345
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
"name": "ru",
|
|
1349
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
"name": "fa",
|
|
1353
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-memo"
|
|
1354
|
+
}
|
|
1355
|
+
]
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
"name": "v-cloak",
|
|
1359
|
+
"description": {
|
|
1360
|
+
"kind": "markdown",
|
|
1361
|
+
"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"
|
|
1362
|
+
},
|
|
1363
|
+
"references": [
|
|
1364
|
+
{
|
|
1365
|
+
"name": "en",
|
|
1366
|
+
"url": "https://vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
"name": "zh-cn",
|
|
1370
|
+
"url": "https://cn.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
"name": "zh-hk",
|
|
1374
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
"name": "ja",
|
|
1378
|
+
"url": "https://ja.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
"name": "ua",
|
|
1382
|
+
"url": "https://ua.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
"name": "fr",
|
|
1386
|
+
"url": "https://fr.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
"name": "ko",
|
|
1390
|
+
"url": "https://ko.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
"name": "pt",
|
|
1394
|
+
"url": "https://pt.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
"name": "bn",
|
|
1398
|
+
"url": "https://bn.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
"name": "it",
|
|
1402
|
+
"url": "https://it.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
"name": "cs",
|
|
1406
|
+
"url": "https://cs.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
"name": "ru",
|
|
1410
|
+
"url": "https://ru.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
"name": "fa",
|
|
1414
|
+
"url": "https://fa.vuejs.org/api/built-in-directives.html#v-cloak"
|
|
1415
|
+
}
|
|
1416
|
+
]
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
"name": "key",
|
|
1420
|
+
"description": {
|
|
1421
|
+
"kind": "markdown",
|
|
1422
|
+
"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://zh-hk.vuejs.org/guide/essentials/list.html#maintaining-state-with-key)\n"
|
|
1423
|
+
},
|
|
1424
|
+
"references": [
|
|
1425
|
+
{
|
|
1426
|
+
"name": "en",
|
|
1427
|
+
"url": "https://vuejs.org/api/built-in-special-attributes.html#key"
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
"name": "zh-cn",
|
|
1431
|
+
"url": "https://cn.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"name": "zh-hk",
|
|
1435
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
"name": "ja",
|
|
1439
|
+
"url": "https://ja.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
"name": "ua",
|
|
1443
|
+
"url": "https://ua.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
"name": "fr",
|
|
1447
|
+
"url": "https://fr.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1448
|
+
},
|
|
1449
|
+
{
|
|
1450
|
+
"name": "ko",
|
|
1451
|
+
"url": "https://ko.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
"name": "pt",
|
|
1455
|
+
"url": "https://pt.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
"name": "bn",
|
|
1459
|
+
"url": "https://bn.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
"name": "it",
|
|
1463
|
+
"url": "https://it.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"name": "cs",
|
|
1467
|
+
"url": "https://cs.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
"name": "ru",
|
|
1471
|
+
"url": "https://ru.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
"name": "fa",
|
|
1475
|
+
"url": "https://fa.vuejs.org/api/built-in-special-attributes.html#key"
|
|
1476
|
+
}
|
|
1477
|
+
]
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
"name": "ref",
|
|
1481
|
+
"description": {
|
|
1482
|
+
"kind": "markdown",
|
|
1483
|
+
"value": "\n用于注册[模板引用](https://zh-hk.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://zh-hk.vuejs.org/guide/essentials/template-refs.html)\n - [指南 - 为模板引用标注类型](https://zh-hk.vuejs.org/guide/typescript/composition-api.html#typing-template-refs) <sup class=\"vt-badge ts\" />\n - [指南 - 为组件模板引用标注类型](https://zh-hk.vuejs.org/guide/typescript/composition-api.html#typing-component-template-refs) <sup class=\"vt-badge ts\" />\n"
|
|
1484
|
+
},
|
|
1485
|
+
"references": [
|
|
1486
|
+
{
|
|
1487
|
+
"name": "en",
|
|
1488
|
+
"url": "https://vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
"name": "zh-cn",
|
|
1492
|
+
"url": "https://cn.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
"name": "zh-hk",
|
|
1496
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
"name": "ja",
|
|
1500
|
+
"url": "https://ja.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
"name": "ua",
|
|
1504
|
+
"url": "https://ua.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
"name": "fr",
|
|
1508
|
+
"url": "https://fr.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
"name": "ko",
|
|
1512
|
+
"url": "https://ko.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
"name": "pt",
|
|
1516
|
+
"url": "https://pt.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
"name": "bn",
|
|
1520
|
+
"url": "https://bn.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
"name": "it",
|
|
1524
|
+
"url": "https://it.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
"name": "cs",
|
|
1528
|
+
"url": "https://cs.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
"name": "ru",
|
|
1532
|
+
"url": "https://ru.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
"name": "fa",
|
|
1536
|
+
"url": "https://fa.vuejs.org/api/built-in-special-attributes.html#ref"
|
|
1537
|
+
}
|
|
1538
|
+
]
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
"name": "is",
|
|
1542
|
+
"description": {
|
|
1543
|
+
"kind": "markdown",
|
|
1544
|
+
"value": "\n用于绑定[动态组件](https://zh-hk.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://zh-hk.vuejs.org/guide/essentials/component-basics.html#in-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://zh-hk.vuejs.org/api/built-in-special-elements.html#component)\n - [动态组件](https://zh-hk.vuejs.org/guide/essentials/component-basics.html#dynamic-components)\n"
|
|
1545
|
+
},
|
|
1546
|
+
"references": [
|
|
1547
|
+
{
|
|
1548
|
+
"name": "en",
|
|
1549
|
+
"url": "https://vuejs.org/api/built-in-special-attributes.html#is"
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
"name": "zh-cn",
|
|
1553
|
+
"url": "https://cn.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
"name": "zh-hk",
|
|
1557
|
+
"url": "https://zh-hk.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
"name": "ja",
|
|
1561
|
+
"url": "https://ja.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
"name": "ua",
|
|
1565
|
+
"url": "https://ua.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
"name": "fr",
|
|
1569
|
+
"url": "https://fr.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
"name": "ko",
|
|
1573
|
+
"url": "https://ko.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
"name": "pt",
|
|
1577
|
+
"url": "https://pt.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
"name": "bn",
|
|
1581
|
+
"url": "https://bn.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
"name": "it",
|
|
1585
|
+
"url": "https://it.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
"name": "cs",
|
|
1589
|
+
"url": "https://cs.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
"name": "ru",
|
|
1593
|
+
"url": "https://ru.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
"name": "fa",
|
|
1597
|
+
"url": "https://fa.vuejs.org/api/built-in-special-attributes.html#is"
|
|
1598
|
+
}
|
|
1599
|
+
]
|
|
1600
|
+
}
|
|
1601
|
+
]
|
|
1602
|
+
}
|