@vue/language-service 1.7.7 → 1.7.9
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
|
@@ -1,626 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 1.1,
|
|
3
|
-
"tags": [
|
|
4
|
-
{
|
|
5
|
-
"name": "template",
|
|
6
|
-
"attributes": [
|
|
7
|
-
{
|
|
8
|
-
"name": "src",
|
|
9
|
-
"description": {
|
|
10
|
-
"kind": "markdown",
|
|
11
|
-
"value": "\n如果你更喜歡將 `*.vue` 組件分散到多個文件中,可以為一個語塊使用 `src` 這個 attribute 來導入一個外部文件:\n\n```vue\n<template src=\"./template.html\"></template>\n<style src=\"./style.css\"></style>\n<script src=\"./script.js\"></script>\n```\n\n請注意 `src` 導入和 JS 模塊導入遵循相同的路徑解析規則,這意味著:\n\n- 相對路徑需要以 `./` 開頭\n- 你也可以從 npm 依賴中導入資源\n\n```vue\n<!-- 從所安裝的 \"todomvc-app-css\" npm 包中導入一個文件 -->\n<style src=\"todomvc-app-css/index.css\" />\n```\n\n`src` 導入對自定義語塊也同樣適用:\n\n```vue\n<unit-test src=\"./unit-test.js\">\n</unit-test>\n```\n"
|
|
12
|
-
},
|
|
13
|
-
"references": [
|
|
14
|
-
{
|
|
15
|
-
"name": "en",
|
|
16
|
-
"url": "https://vuejs.org/api/sfc-spec.html#src-imports"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"name": "zh-cn",
|
|
20
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#src-imports"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"name": "ja",
|
|
24
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#src-imports"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"name": "ua",
|
|
28
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#src-imports"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"name": "fr",
|
|
32
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#src-imports"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"name": "ko",
|
|
36
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"name": "lang",
|
|
42
|
-
"description": {
|
|
43
|
-
"kind": "markdown",
|
|
44
|
-
"value": "\n代碼塊可以使用 `lang` 這個 attribute 來聲明預處理器語言,最常見的用例就是在 `<script>` 中使用 TypeScript:\n\n```html\n<script lang=\"ts\">\n // use TypeScript\n</script>\n```\n\n`lang` 在任意塊上都能使用,比如我們可以在 `<style>` 標籤中使用 [Sass](https://sass-lang.com/) 或是 `<template>` 中使用 [Pug](https://pugjs.org/api/getting-started.html):\n\n```html\n<template lang=\"pug\">\np {{ msg }}\n</template>\n\n<style lang=\"scss\">\n $primary-color: #333;\n body {\n color: $primary-color;\n }\n</style>\n```\n\n注意對不同預處理器的集成會根據你所使用的工具鏈而有所不同,具體細節請查看相應的工具鏈文檔來確認:\n\n- [Vite](https://cn.vitejs.dev/guide/features.html#css-pre-processors)\n- [Vue CLI](https://cli.vuejs.org/zh/guide/css.html#%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n- [webpack + vue-loader](https://vue-loader.vuejs.org/zh/guide/pre-processors.html#%E4%BD%BF%E7%94%A8%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n"
|
|
45
|
-
},
|
|
46
|
-
"values": [
|
|
47
|
-
{
|
|
48
|
-
"name": "html"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": "pug"
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
"references": [
|
|
55
|
-
{
|
|
56
|
-
"name": "en",
|
|
57
|
-
"url": "https://vuejs.org/api/sfc-spec.html#pre-processors"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"name": "zh-cn",
|
|
61
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"name": "ja",
|
|
65
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"name": "ua",
|
|
69
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"name": "fr",
|
|
73
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"name": "ko",
|
|
77
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
],
|
|
82
|
-
"description": {
|
|
83
|
-
"kind": "markdown",
|
|
84
|
-
"value": "\n- 每個 `*.vue` 文件最多可以包含一個頂層 `<template>` 塊。\n\n- 語塊包裹的內容將會被提取、傳遞給 `@vue/compiler-dom`,預編譯為 JavaScript 渲染函數,並附在導出的組件上作為其 `render` 選項。\n"
|
|
85
|
-
},
|
|
86
|
-
"references": [
|
|
87
|
-
{
|
|
88
|
-
"name": "en",
|
|
89
|
-
"url": "https://vuejs.org/api/sfc-spec.html#template"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "zh-cn",
|
|
93
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#template"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"name": "ja",
|
|
97
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#template"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"name": "ua",
|
|
101
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#template"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"name": "fr",
|
|
105
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#template"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"name": "ko",
|
|
109
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#template"
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"name": "script",
|
|
115
|
-
"attributes": [
|
|
116
|
-
{
|
|
117
|
-
"name": "src",
|
|
118
|
-
"description": {
|
|
119
|
-
"kind": "markdown",
|
|
120
|
-
"value": "\n如果你更喜歡將 `*.vue` 組件分散到多個文件中,可以為一個語塊使用 `src` 這個 attribute 來導入一個外部文件:\n\n```vue\n<template src=\"./template.html\"></template>\n<style src=\"./style.css\"></style>\n<script src=\"./script.js\"></script>\n```\n\n請注意 `src` 導入和 JS 模塊導入遵循相同的路徑解析規則,這意味著:\n\n- 相對路徑需要以 `./` 開頭\n- 你也可以從 npm 依賴中導入資源\n\n```vue\n<!-- 從所安裝的 \"todomvc-app-css\" npm 包中導入一個文件 -->\n<style src=\"todomvc-app-css/index.css\" />\n```\n\n`src` 導入對自定義語塊也同樣適用:\n\n```vue\n<unit-test src=\"./unit-test.js\">\n</unit-test>\n```\n"
|
|
121
|
-
},
|
|
122
|
-
"references": [
|
|
123
|
-
{
|
|
124
|
-
"name": "en",
|
|
125
|
-
"url": "https://vuejs.org/api/sfc-spec.html#src-imports"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"name": "zh-cn",
|
|
129
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#src-imports"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"name": "ja",
|
|
133
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#src-imports"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"name": "ua",
|
|
137
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#src-imports"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"name": "fr",
|
|
141
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#src-imports"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"name": "ko",
|
|
145
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports"
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"name": "lang",
|
|
151
|
-
"description": {
|
|
152
|
-
"kind": "markdown",
|
|
153
|
-
"value": "\n代碼塊可以使用 `lang` 這個 attribute 來聲明預處理器語言,最常見的用例就是在 `<script>` 中使用 TypeScript:\n\n```html\n<script lang=\"ts\">\n // use TypeScript\n</script>\n```\n\n`lang` 在任意塊上都能使用,比如我們可以在 `<style>` 標籤中使用 [Sass](https://sass-lang.com/) 或是 `<template>` 中使用 [Pug](https://pugjs.org/api/getting-started.html):\n\n```html\n<template lang=\"pug\">\np {{ msg }}\n</template>\n\n<style lang=\"scss\">\n $primary-color: #333;\n body {\n color: $primary-color;\n }\n</style>\n```\n\n注意對不同預處理器的集成會根據你所使用的工具鏈而有所不同,具體細節請查看相應的工具鏈文檔來確認:\n\n- [Vite](https://cn.vitejs.dev/guide/features.html#css-pre-processors)\n- [Vue CLI](https://cli.vuejs.org/zh/guide/css.html#%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n- [webpack + vue-loader](https://vue-loader.vuejs.org/zh/guide/pre-processors.html#%E4%BD%BF%E7%94%A8%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n"
|
|
154
|
-
},
|
|
155
|
-
"values": [
|
|
156
|
-
{
|
|
157
|
-
"name": "ts"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"name": "js"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"name": "tsx"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"name": "jsx"
|
|
167
|
-
}
|
|
168
|
-
],
|
|
169
|
-
"references": [
|
|
170
|
-
{
|
|
171
|
-
"name": "en",
|
|
172
|
-
"url": "https://vuejs.org/api/sfc-spec.html#pre-processors"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
"name": "zh-cn",
|
|
176
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"name": "ja",
|
|
180
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"name": "ua",
|
|
184
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"name": "fr",
|
|
188
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"name": "ko",
|
|
192
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
193
|
-
}
|
|
194
|
-
]
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"name": "generic"
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
"name": "setup",
|
|
201
|
-
"valueSet": "v",
|
|
202
|
-
"description": {
|
|
203
|
-
"kind": "markdown",
|
|
204
|
-
"value": "\n- 每個 `*.vue` 文件最多可以包含一個 `<script setup>`。(不包括一般的 `<script>`)\n\n- 這個腳本塊將被預處理為組件的 `setup()` 函數,這意味著它將**為每一個組件實例**都執行。`<script setup>` 中的頂層綁定都將自動暴露給模板。要了解更多細節,請看 [`<script setup>` 的專門文檔](https://cn.vuejs.org/api/sfc-script-setup.html)。\n"
|
|
205
|
-
},
|
|
206
|
-
"references": [
|
|
207
|
-
{
|
|
208
|
-
"name": "en",
|
|
209
|
-
"url": "https://vuejs.org/api/sfc-spec.html#script-setup"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"name": "zh-cn",
|
|
213
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#script-setup"
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
"name": "ja",
|
|
217
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#script-setup"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"name": "ua",
|
|
221
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#script-setup"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"name": "fr",
|
|
225
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#script-setup"
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"name": "ko",
|
|
229
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup"
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
}
|
|
233
|
-
],
|
|
234
|
-
"description": {
|
|
235
|
-
"kind": "markdown",
|
|
236
|
-
"value": "\n- 每個 `*.vue` 文件最多可以包含一個 `<script>` 塊。(使用 [`<script setup>`](https://cn.vuejs.org/api/sfc-script-setup.html) 的情況除外)\n\n- 這個腳本代碼塊將作為 ES 模塊執行。\n\n- **默認導出**應該是 Vue 的組件選項對象,可以是一個對象字面量或是 [defineComponent](https://cn.vuejs.org/api/general.html#definecomponent) 函數的返回值。\n"
|
|
237
|
-
},
|
|
238
|
-
"references": [
|
|
239
|
-
{
|
|
240
|
-
"name": "en",
|
|
241
|
-
"url": "https://vuejs.org/api/sfc-spec.html#script"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"name": "zh-cn",
|
|
245
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#script"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"name": "ja",
|
|
249
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#script"
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
"name": "ua",
|
|
253
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#script"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"name": "fr",
|
|
257
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#script"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"name": "ko",
|
|
261
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#script"
|
|
262
|
-
}
|
|
263
|
-
]
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"name": "script setup",
|
|
267
|
-
"attributes": [],
|
|
268
|
-
"description": {
|
|
269
|
-
"kind": "markdown",
|
|
270
|
-
"value": "\n- 每個 `*.vue` 文件最多可以包含一個 `<script setup>`。(不包括一般的 `<script>`)\n\n- 這個腳本塊將被預處理為組件的 `setup()` 函數,這意味著它將**為每一個組件實例**都執行。`<script setup>` 中的頂層綁定都將自動暴露給模板。要了解更多細節,請看 [`<script setup>` 的專門文檔](https://cn.vuejs.org/api/sfc-script-setup.html)。\n"
|
|
271
|
-
},
|
|
272
|
-
"references": [
|
|
273
|
-
{
|
|
274
|
-
"name": "en",
|
|
275
|
-
"url": "https://vuejs.org/api/sfc-spec.html#script-setup"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"name": "zh-cn",
|
|
279
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#script-setup"
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
"name": "ja",
|
|
283
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#script-setup"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"name": "ua",
|
|
287
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#script-setup"
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"name": "fr",
|
|
291
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#script-setup"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"name": "ko",
|
|
295
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#script-setup"
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
"name": "style",
|
|
301
|
-
"attributes": [
|
|
302
|
-
{
|
|
303
|
-
"name": "src",
|
|
304
|
-
"description": {
|
|
305
|
-
"kind": "markdown",
|
|
306
|
-
"value": "\n如果你更喜歡將 `*.vue` 組件分散到多個文件中,可以為一個語塊使用 `src` 這個 attribute 來導入一個外部文件:\n\n```vue\n<template src=\"./template.html\"></template>\n<style src=\"./style.css\"></style>\n<script src=\"./script.js\"></script>\n```\n\n請注意 `src` 導入和 JS 模塊導入遵循相同的路徑解析規則,這意味著:\n\n- 相對路徑需要以 `./` 開頭\n- 你也可以從 npm 依賴中導入資源\n\n```vue\n<!-- 從所安裝的 \"todomvc-app-css\" npm 包中導入一個文件 -->\n<style src=\"todomvc-app-css/index.css\" />\n```\n\n`src` 導入對自定義語塊也同樣適用:\n\n```vue\n<unit-test src=\"./unit-test.js\">\n</unit-test>\n```\n"
|
|
307
|
-
},
|
|
308
|
-
"references": [
|
|
309
|
-
{
|
|
310
|
-
"name": "en",
|
|
311
|
-
"url": "https://vuejs.org/api/sfc-spec.html#src-imports"
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"name": "zh-cn",
|
|
315
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#src-imports"
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
"name": "ja",
|
|
319
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#src-imports"
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
"name": "ua",
|
|
323
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#src-imports"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"name": "fr",
|
|
327
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#src-imports"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"name": "ko",
|
|
331
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports"
|
|
332
|
-
}
|
|
333
|
-
]
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
"name": "lang",
|
|
337
|
-
"description": {
|
|
338
|
-
"kind": "markdown",
|
|
339
|
-
"value": "\n代碼塊可以使用 `lang` 這個 attribute 來聲明預處理器語言,最常見的用例就是在 `<script>` 中使用 TypeScript:\n\n```html\n<script lang=\"ts\">\n // use TypeScript\n</script>\n```\n\n`lang` 在任意塊上都能使用,比如我們可以在 `<style>` 標籤中使用 [Sass](https://sass-lang.com/) 或是 `<template>` 中使用 [Pug](https://pugjs.org/api/getting-started.html):\n\n```html\n<template lang=\"pug\">\np {{ msg }}\n</template>\n\n<style lang=\"scss\">\n $primary-color: #333;\n body {\n color: $primary-color;\n }\n</style>\n```\n\n注意對不同預處理器的集成會根據你所使用的工具鏈而有所不同,具體細節請查看相應的工具鏈文檔來確認:\n\n- [Vite](https://cn.vitejs.dev/guide/features.html#css-pre-processors)\n- [Vue CLI](https://cli.vuejs.org/zh/guide/css.html#%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n- [webpack + vue-loader](https://vue-loader.vuejs.org/zh/guide/pre-processors.html#%E4%BD%BF%E7%94%A8%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n"
|
|
340
|
-
},
|
|
341
|
-
"values": [
|
|
342
|
-
{
|
|
343
|
-
"name": "css"
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
"name": "scss"
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
"name": "less"
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"name": "stylus"
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
"name": "postcss"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
"name": "sass"
|
|
359
|
-
}
|
|
360
|
-
],
|
|
361
|
-
"references": [
|
|
362
|
-
{
|
|
363
|
-
"name": "en",
|
|
364
|
-
"url": "https://vuejs.org/api/sfc-spec.html#pre-processors"
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
"name": "zh-cn",
|
|
368
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
"name": "ja",
|
|
372
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
"name": "ua",
|
|
376
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
"name": "fr",
|
|
380
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"name": "ko",
|
|
384
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
385
|
-
}
|
|
386
|
-
]
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
"name": "scoped",
|
|
390
|
-
"valueSet": "v",
|
|
391
|
-
"description": {
|
|
392
|
-
"kind": "markdown",
|
|
393
|
-
"value": "\n當 `<style>` 標籤帶有 `scoped` attribute 的時候,它的 CSS 只會影響當前組件的元素,和 Shadow DOM 中的樣式封裝類似。使用時有一些注意事項,不過好處是不需要任何的 polyfill。它的實現方式是通過 PostCSS 將以下內容:\n\n```vue\n<style scoped>\n.example {\n color: red;\n}\n</style>\n\n<template>\n <div class=\"example\">hi</div>\n</template>\n```\n\n轉換為:\n\n```vue\n<style>\n.example[data-v-f3f3eg9] {\n color: red;\n}\n</style>\n\n<template>\n <div class=\"example\" data-v-f3f3eg9>hi</div>\n</template>\n```\n\n### 子組件的根元素 \n\n使用 `scoped` 後,父組件的樣式將不會滲透到子組件中。不過,子組件的根節點會同時被父組件的作用域樣式和子組件的作用域樣式影響。這樣設計是為了讓父組件可以從佈局的角度出發,調整其子組件根元素的樣式。\n\n### 深度選擇器 \n\n處於 `scoped` 樣式中的選擇器如果想要做更“深度”的選擇,也即:影響到子組件,可以使用 `:deep()` 這個偽類:\n\n```vue\n<style scoped>\n.a :deep(.b) {\n /* ... */\n}\n</style>\n```\n\n上面的代碼會被編譯成:\n\n```css\n.a[data-v-f3f3eg9] .b {\n /* ... */\n}\n```\n\n:::tip\n通過 `v-html` 創建的 DOM 內容不會被作用域樣式影響,但你仍然可以使用深度選擇器來設置其樣式。\n:::\n\n### 插槽選擇器 \n\n默認情況下,作用域樣式不會影響到 `<slot/>` 渲染出來的內容,因為它們被認為是父組件所持有並傳遞進來的。使用 `:slotted` 偽類以明確地將插槽內容作為選擇器的目標:\n\n```vue\n<style scoped>\n:slotted(div) {\n color: red;\n}\n</style>\n```\n\n### 全局選擇器 \n\n如果想讓其中一個樣式規則應用到全局,比起另外創建一個 `<style>`,可以使用 `:global` 偽類來實現 (看下面的代碼):\n\n```vue\n<style scoped>\n:global(.red) {\n color: red;\n}\n</style>\n```\n\n### 混合使用局部與全局樣式 \n\n你也可以在同一個組件中同時包含作用域樣式和非作用域樣式:\n\n```vue\n<style>\n/* 全局樣式 */\n</style>\n\n<style scoped>\n/* 局部樣式 */\n</style>\n```\n\n### 作用域樣式須知 \n\n- **作用域樣式並沒有消除對 class 的需求**。由於瀏覽器渲染各種各樣 CSS 選擇器的方式,`p { color: red }` 結合作用域樣式使用時 (即當與 attribute 選擇器組合的時候) 會慢很多倍。如果你使用 class 或者 id 來替代,例如 `.example { color: red }`,那你幾乎就可以避免性能的損失。\n\n- **小心遞歸組件中的後代選擇器**!對於一個使用了 `.a .b` 選擇器的樣式規則來說,如果匹配到 `.a` 的元素包含了一個遞歸的子組件,那麼所有的在那個子組件中的 `.b` 都會匹配到這條樣式規則。\n"
|
|
394
|
-
},
|
|
395
|
-
"references": [
|
|
396
|
-
{
|
|
397
|
-
"name": "en",
|
|
398
|
-
"url": "https://vuejs.org/api/sfc-css-features.html#scoped-css"
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
"name": "zh-cn",
|
|
402
|
-
"url": "https://cn.vuejs.org/api/sfc-css-features.html#scoped-css"
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
"name": "ja",
|
|
406
|
-
"url": "https://ja.vuejs.org/api/sfc-css-features.html#scoped-css"
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
"name": "ua",
|
|
410
|
-
"url": "https://ua.vuejs.org/api/sfc-css-features.html#scoped-css"
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
"name": "fr",
|
|
414
|
-
"url": "https://fr.vuejs.org/api/sfc-css-features.html#scoped-css"
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
"name": "ko",
|
|
418
|
-
"url": "https://ko.vuejs.org/api/sfc-css-features.html#scoped-css"
|
|
419
|
-
}
|
|
420
|
-
]
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
"name": "module",
|
|
424
|
-
"valueSet": "v",
|
|
425
|
-
"description": {
|
|
426
|
-
"kind": "markdown",
|
|
427
|
-
"value": "\n一個 `<style module>` 標籤會被編譯為 [CSS Modules](https://github.com/css-modules/css-modules) 並且將生成的 CSS class 作為 `$style` 對象暴露給組件:\n\n```vue\n<template>\n <p :class=\"$style.red\">This should be red</p>\n</template>\n\n<style module>\n.red {\n color: red;\n}\n</style>\n```\n\n得出的 class 將被哈希化以避免衝突,實現了同樣的將 CSS 僅作用於當前組件的效果。\n\n參考 [CSS Modules spec](https://github.com/css-modules/css-modules) 以查看更多詳情,例如 [global exceptions](https://github.com/css-modules/css-modules#exceptions) 和 [composition](https://github.com/css-modules/css-modules#composition)。\n\n### 自定義注入名稱 \n\n你可以通過給 `module` attribute 一個值來自定義注入 class 對象的屬性名:\n\n```vue\n<template>\n <p :class=\"classes.red\">red</p>\n</template>\n\n<style module=\"classes\">\n.red {\n color: red;\n}\n</style>\n```\n\n### 與組合式 API 一同使用 \n\n可以通過 `useCssModule` API 在 `setup()` 和 `<script setup>` 中訪問注入的 class。對於使用了自定義注入名稱的 `<style module>` 塊,`useCssModule` 接收一個匹配的 `module` attribute 值作為第一個參數:\n\n```js\nimport { useCssModule } from 'vue'\n\n// 在 setup() 作用域中...\n// 默認情況下, 返回 <style module> 的 class\nuseCssModule()\n\n// 具名情況下, 返回 <style module=\"classes\"> 的 class\nuseCssModule('classes')\n```\n"
|
|
428
|
-
},
|
|
429
|
-
"references": [
|
|
430
|
-
{
|
|
431
|
-
"name": "en",
|
|
432
|
-
"url": "https://vuejs.org/api/sfc-css-features.html#css-modules"
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
"name": "zh-cn",
|
|
436
|
-
"url": "https://cn.vuejs.org/api/sfc-css-features.html#css-modules"
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
"name": "ja",
|
|
440
|
-
"url": "https://ja.vuejs.org/api/sfc-css-features.html#css-modules"
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
"name": "ua",
|
|
444
|
-
"url": "https://ua.vuejs.org/api/sfc-css-features.html#css-modules"
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
"name": "fr",
|
|
448
|
-
"url": "https://fr.vuejs.org/api/sfc-css-features.html#css-modules"
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
"name": "ko",
|
|
452
|
-
"url": "https://ko.vuejs.org/api/sfc-css-features.html#css-modules"
|
|
453
|
-
}
|
|
454
|
-
]
|
|
455
|
-
}
|
|
456
|
-
],
|
|
457
|
-
"description": {
|
|
458
|
-
"kind": "markdown",
|
|
459
|
-
"value": "\n- 每個 `*.vue` 文件可以包含多個 `<style>` 標籤。\n\n- 一個 `<style>` 標籤可以使用 `scoped` 或 `module` attribute (查看 [SFC 樣式功能](https://cn.vuejs.org/api/sfc-css-features.html)瞭解更多細節) 來幫助封裝當前組件的樣式。使用了不同封裝模式的多個 `<style>` 標籤可以被混合入同一個組件。\n"
|
|
460
|
-
},
|
|
461
|
-
"references": [
|
|
462
|
-
{
|
|
463
|
-
"name": "en",
|
|
464
|
-
"url": "https://vuejs.org/api/sfc-spec.html#style"
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
"name": "zh-cn",
|
|
468
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#style"
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
"name": "ja",
|
|
472
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#style"
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
"name": "ua",
|
|
476
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#style"
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
"name": "fr",
|
|
480
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#style"
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
"name": "ko",
|
|
484
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#style"
|
|
485
|
-
}
|
|
486
|
-
]
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
"name": "自定義塊",
|
|
490
|
-
"attributes": [
|
|
491
|
-
{
|
|
492
|
-
"name": "src",
|
|
493
|
-
"description": {
|
|
494
|
-
"kind": "markdown",
|
|
495
|
-
"value": "\n如果你更喜歡將 `*.vue` 組件分散到多個文件中,可以為一個語塊使用 `src` 這個 attribute 來導入一個外部文件:\n\n```vue\n<template src=\"./template.html\"></template>\n<style src=\"./style.css\"></style>\n<script src=\"./script.js\"></script>\n```\n\n請注意 `src` 導入和 JS 模塊導入遵循相同的路徑解析規則,這意味著:\n\n- 相對路徑需要以 `./` 開頭\n- 你也可以從 npm 依賴中導入資源\n\n```vue\n<!-- 從所安裝的 \"todomvc-app-css\" npm 包中導入一個文件 -->\n<style src=\"todomvc-app-css/index.css\" />\n```\n\n`src` 導入對自定義語塊也同樣適用:\n\n```vue\n<unit-test src=\"./unit-test.js\">\n</unit-test>\n```\n"
|
|
496
|
-
},
|
|
497
|
-
"references": [
|
|
498
|
-
{
|
|
499
|
-
"name": "en",
|
|
500
|
-
"url": "https://vuejs.org/api/sfc-spec.html#src-imports"
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
"name": "zh-cn",
|
|
504
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#src-imports"
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
"name": "ja",
|
|
508
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#src-imports"
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
"name": "ua",
|
|
512
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#src-imports"
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
"name": "fr",
|
|
516
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#src-imports"
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
"name": "ko",
|
|
520
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports"
|
|
521
|
-
}
|
|
522
|
-
]
|
|
523
|
-
}
|
|
524
|
-
],
|
|
525
|
-
"description": {
|
|
526
|
-
"kind": "markdown",
|
|
527
|
-
"value": "\n在一個 `*.vue` 文件中可以為任何項目特定需求使用額外的自定義塊。舉例來說,一個用作寫文檔的 `<docs>` 塊。這裡是一些自定義塊的真實用例:\n\n- [Gridsome:`<page-query>`](https://gridsome.org/docs/querying-data/)\n- [vite-plugin-vue-gql:`<gql>`](https://github.com/wheatjs/vite-plugin-vue-gql)\n- [vue-i18n:`<i18n>`](https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n#i18n-custom-block)\n\n自定義塊的處理需要依賴工具鏈。如果你想要在構建中集成你的自定義語塊,請參見 [SFC 自定義塊集成工具鏈指南](https://cn.vuejs.org/guide/scaling-up/tooling.html#sfc-custom-block-integrations)獲取更多細節。\n"
|
|
528
|
-
},
|
|
529
|
-
"references": [
|
|
530
|
-
{
|
|
531
|
-
"name": "en",
|
|
532
|
-
"url": "https://vuejs.org/api/sfc-spec.html#自定義塊"
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
"name": "zh-cn",
|
|
536
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#自定義塊"
|
|
537
|
-
},
|
|
538
|
-
{
|
|
539
|
-
"name": "ja",
|
|
540
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#自定義塊"
|
|
541
|
-
},
|
|
542
|
-
{
|
|
543
|
-
"name": "ua",
|
|
544
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#自定義塊"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
"name": "fr",
|
|
548
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#自定義塊"
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
"name": "ko",
|
|
552
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#自定義塊"
|
|
553
|
-
}
|
|
554
|
-
]
|
|
555
|
-
}
|
|
556
|
-
],
|
|
557
|
-
"globalAttributes": [
|
|
558
|
-
{
|
|
559
|
-
"name": "lang",
|
|
560
|
-
"description": {
|
|
561
|
-
"kind": "markdown",
|
|
562
|
-
"value": "\n代碼塊可以使用 `lang` 這個 attribute 來聲明預處理器語言,最常見的用例就是在 `<script>` 中使用 TypeScript:\n\n```html\n<script lang=\"ts\">\n // use TypeScript\n</script>\n```\n\n`lang` 在任意塊上都能使用,比如我們可以在 `<style>` 標籤中使用 [Sass](https://sass-lang.com/) 或是 `<template>` 中使用 [Pug](https://pugjs.org/api/getting-started.html):\n\n```html\n<template lang=\"pug\">\np {{ msg }}\n</template>\n\n<style lang=\"scss\">\n $primary-color: #333;\n body {\n color: $primary-color;\n }\n</style>\n```\n\n注意對不同預處理器的集成會根據你所使用的工具鏈而有所不同,具體細節請查看相應的工具鏈文檔來確認:\n\n- [Vite](https://cn.vitejs.dev/guide/features.html#css-pre-processors)\n- [Vue CLI](https://cli.vuejs.org/zh/guide/css.html#%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n- [webpack + vue-loader](https://vue-loader.vuejs.org/zh/guide/pre-processors.html#%E4%BD%BF%E7%94%A8%E9%A2%84%E5%A4%84%E7%90%86%E5%99%A8)\n"
|
|
563
|
-
},
|
|
564
|
-
"values": [],
|
|
565
|
-
"references": [
|
|
566
|
-
{
|
|
567
|
-
"name": "en",
|
|
568
|
-
"url": "https://vuejs.org/api/sfc-spec.html#pre-processors"
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
"name": "zh-cn",
|
|
572
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
"name": "ja",
|
|
576
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
"name": "ua",
|
|
580
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
"name": "fr",
|
|
584
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
"name": "ko",
|
|
588
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#pre-processors"
|
|
589
|
-
}
|
|
590
|
-
]
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
"name": "src",
|
|
594
|
-
"description": {
|
|
595
|
-
"kind": "markdown",
|
|
596
|
-
"value": "\n如果你更喜歡將 `*.vue` 組件分散到多個文件中,可以為一個語塊使用 `src` 這個 attribute 來導入一個外部文件:\n\n```vue\n<template src=\"./template.html\"></template>\n<style src=\"./style.css\"></style>\n<script src=\"./script.js\"></script>\n```\n\n請注意 `src` 導入和 JS 模塊導入遵循相同的路徑解析規則,這意味著:\n\n- 相對路徑需要以 `./` 開頭\n- 你也可以從 npm 依賴中導入資源\n\n```vue\n<!-- 從所安裝的 \"todomvc-app-css\" npm 包中導入一個文件 -->\n<style src=\"todomvc-app-css/index.css\" />\n```\n\n`src` 導入對自定義語塊也同樣適用:\n\n```vue\n<unit-test src=\"./unit-test.js\">\n</unit-test>\n```\n"
|
|
597
|
-
},
|
|
598
|
-
"references": [
|
|
599
|
-
{
|
|
600
|
-
"name": "en",
|
|
601
|
-
"url": "https://vuejs.org/api/sfc-spec.html#src-imports"
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
"name": "zh-cn",
|
|
605
|
-
"url": "https://cn.vuejs.org/api/sfc-spec.html#src-imports"
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
"name": "ja",
|
|
609
|
-
"url": "https://ja.vuejs.org/api/sfc-spec.html#src-imports"
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
"name": "ua",
|
|
613
|
-
"url": "https://ua.vuejs.org/api/sfc-spec.html#src-imports"
|
|
614
|
-
},
|
|
615
|
-
{
|
|
616
|
-
"name": "fr",
|
|
617
|
-
"url": "https://fr.vuejs.org/api/sfc-spec.html#src-imports"
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
"name": "ko",
|
|
621
|
-
"url": "https://ko.vuejs.org/api/sfc-spec.html#src-imports"
|
|
622
|
-
}
|
|
623
|
-
]
|
|
624
|
-
}
|
|
625
|
-
]
|
|
626
|
-
}
|