-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathsyntax.js
363 lines (363 loc) · 17.4 KB
/
syntax.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
module.exports = {
type: 'syntax',
name: { zh: '语法', en: 'Syntax' },
group: [{
type: 'text-binding',
name: { zh: '文本绑定', en: 'Text Binding' },
title: { zh: '文本绑定', en: 'Text Binding' },
desc: {
zh: '数据绑定最常见的形式就是使用 “Mustache” 语法(双大括号)的文本插值。',
en: 'The most basic form of data binding is text interpolation using the “Mustache” syntax (double curly braces).'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/syntax.html#插值',
en: 'https://vuejs.org/v2/guide/syntax.html#Interpolations'
},
examples: [{
hash: {
zh: '34e42c91e1f86591563ec8897e6a095c',
en: '207411d00e8af32213443b4d0c5db689'
},
title: { zh: '文本插值', en: 'Inline TextNode' },
screenshot: {
zh: 'https://gw.alicdn.com/tfs/TB1V5IXcMMPMeJjy1XdXXasrXXa-540-844.png',
en: 'https://gw.alicdn.com/tfs/TB19gKsb8fH8KJjy1XbXXbLdXXa-540-844.png'
}
}, {
hash: '68b02a5371eb7da5cb9dde1946ce2b68',
title: { zh: '使用表达式', en: 'Using Expression' },
screenshot: 'https://gw.alicdn.com/tfs/TB1veLGbS_I8KJjy0FoXXaFnVXa-540-844.png'
}]
}, {
type: 'v-bind',
name: 'v-bind',
title: { zh: '绑定属性值(v-bind)', en: 'v-bind' },
desc: {
zh: 'v-bind 可以动态地绑定一个或多个特性,或一个组件 prop 到表达式。可以简写成 `:` (半角冒号)。',
en: 'Dynamically bind one or more attributes, or a component prop to an expression.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/api/#v-bind',
en: 'https://vuejs.org/v2/api/#v-bind'
},
examples: [{
hash: 'b62f1a5f4973f43fae9adca02864eb8b',
title: { zh: '绑定属性值', en: 'Binding Props' },
screenshot: 'https://gw.alicdn.com/tfs/TB150aYcMoQMeJjy0FpXXcTxpXa-540-844.png'
}, {
hash: 'b142f24d2f0ab27f5f65448d2aa16970',
title: { zh: '绑定表达式', en: 'Using Expression' },
screenshot: 'https://gw.alicdn.com/tfs/TB1veLGbS_I8KJjy0FoXXaFnVXa-540-844.png'
}, {
hash: '3a2cc3c7a465f6a07c4bd3a868c7e393',
title: { zh: '样式值绑定', en: 'Style Binding' },
screenshot: 'https://gw.alicdn.com/tfs/TB1o.62bH_I8KJjy1XaXXbsxpXa-540-844.png'
}, {
hash: '2bc0de9ec2448a1f852f354349f66600',
// hash: 'b4b1f5e4679efbe3c94864a1404bfeaf',
title: { zh: '类名绑定', en: 'Class Binding' },
screenshot: 'https://gw.alicdn.com/tfs/TB1o.62bH_I8KJjy1XaXXbsxpXa-540-844.png'
}]
}, {
type: 'v-for',
name: 'v-for',
title: { zh: '循环指令(v-for)', en: 'v-for' },
desc: {
zh: 'v-for 基于源数据多次渲染元素或模板块。此指令之值,必须使用特定语法 `alias in expression` 为当前遍历的元素提供别名。',
en: 'We can use the v-for directive to render a `alias in expression` based on an array. The v-for directive requires a special syntax in the form of item in items.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/list.html',
en: 'https://vuejs.org/v2/guide/list.html'
},
examples: [{
hash: '38904c807f66b1a11de5ddf0d40b3d30',
title: { zh: '最简例子', en: 'Sample' },
screenshot: 'https://gw.alicdn.com/tfs/TB1R_7.bjihSKJjy0FlXXadEXXa-540-844.png'
}, {
hash: '2cd124954175721d9145571bf722ce7a',
title: { zh: '下标索引', en: 'Array Index' },
screenshot: 'https://gw.alicdn.com/tfs/TB1dAivaLBNTKJjy0FdXXcPpVXa-540-844.png'
}, {
hash: '2b4222b828fac65257d9ed9f8932f2a1',
title: { zh: '遍历 JS 对象', en: 'v-for With an Object' },
screenshot: 'https://gw.alicdn.com/tfs/TB10r25bH_I8KJjy1XaXXbsxpXa-540-844.png'
}, {
hash: '7364e9c3c25ab2cbc945903cea7b0878',
title: { zh: '多层循环', en: 'Multiple v-for' },
screenshot: 'https://gw.alicdn.com/tfs/TB1giSLfwoQMeJjy0FoXXcShVXa-540-844.png'
}]
}, {
type: 'v-if',
name: 'v-if',
title: { zh: '条件指令(v-if)', en: 'v-if' },
desc: {
zh: 'v-if 根据表达式的值的真假条件渲染元素,在切换时元素及它的数据绑定/组件被销毁并重建。同类指令还有 v-else 和 v-else-if。',
en: 'Conditionally render the element based on the truthy-ness of the expression value.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/conditional.html',
en: 'https://vuejs.org/v2/guide/conditional.html'
},
examples: [{
hash: '736a5dd112a1a114a559218ed20cae08',
title: 'v-if',
screenshot: 'https://gw.alicdn.com/tfs/TB1BAuGb2DH8KJjy1XcXXcpdXXa-540-844.png'
}, {
hash: 'b6b244c4d8623565e77d9de324ca8de1',
title: 'v-else',
screenshot: 'https://gw.alicdn.com/tfs/TB1P.TpdxrI8KJjy0FpXXb5hVXa-540-844.png'
}, {
hash: '22faff4ee6f235c0e8fb98b21c1ea662',
title: 'v-else-if',
screenshot: 'https://gw.alicdn.com/tfs/TB1P.TpdxrI8KJjy0FpXXb5hVXa-540-844.png'
}]
}, {
type: 'v-on',
name: 'v-on',
title: { zh: '事件绑定(v-on)', en: 'v-on' },
desc: {
zh: '可以用 v-on 指令监听 DOM 事件来触发一些 JavaScript 代码,可以简写成 `@`。用在普通元素上时,只能监听 原生 DOM 事件。用在自定义元素组件上时,也可以监听子组件触发的自定义事件。',
en: 'We can use the v-on directive to listen to DOM events and run some JavaScript when they’re triggered.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/events.html#监听事件',
en: 'https://vuejs.org/v2/guide/events.html'
},
examples: [{
hash: 'a3607094a4bf73a069a5c51efb47fe98',
title: { zh: '最简例子', en: 'Sample' },
screenshot: 'https://gw.alicdn.com/tfs/TB1dcTaewMPMeJjy1XdXXasrXXa-540-844.png'
}, {
hash: '8e3a1cbcf1ba9af94fe6f77e9668e354',
title: { zh: '内联语句', en: 'Inline Statement' },
screenshot: 'https://gw.alicdn.com/tfs/TB1dcTaewMPMeJjy1XdXXasrXXa-540-844.png'
}, {
hash: '3a019f2eca4a6966ee0c3b91e5b2fc5b',
title: { zh: '传递参数', en: 'Inline Handler' },
screenshot: 'https://gw.alicdn.com/tfs/TB1dcTaewMPMeJjy1XdXXasrXXa-540-844.png'
}, {
hash: '8581f4d2ff8fb48bdc547d2465c0cf24',
title: { zh: 'once 修饰符', en: '.once Modifier' },
screenshot: 'https://gw.alicdn.com/tfs/TB1dcTaewMPMeJjy1XdXXasrXXa-540-844.png'
}]
}, {
type: 'v-model',
name: 'v-model',
title: { zh: '表单双向绑定(v-model)', en: 'v-model' },
desc: {
zh: '可以用 v-model 指令在表单控件元素上创建双向数据绑定。它会根据控件类型自动选取正确的方法来更新元素。尽管有些神奇,但 v-model 本质上不过是语法糖,它负责监听用户的输入事件以更新数据,并特别处理一些极端的例子。',
en: 'You can use the v-model directive to create two-way data bindings on form input and textarea elements. It automatically picks the correct way to update the element based on the input type.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/forms.html',
en: 'https://vuejs.org/v2/guide/forms.html'
},
examples: [{
hash: 'e1e4413c5252dc763b01f26ce60d5ee4',
title: { zh: '最简例子', en: 'Sample' },
screenshot: 'https://gw.alicdn.com/tfs/TB1IQ9cdgMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: '39684e82ad9a8e0b175f49e058cf7af6',
title: { zh: '绑定 <textarea>', en: 'Using <textarea>' },
screenshot: 'https://gw.alicdn.com/tfs/TB1y738XiqAXuNjy1XdXXaYcVXa-540-844.png'
}, {
hash: '4624d605004fc7eb9f14ca9c5a226fe3',
title: { zh: '各种表单组件', en: '' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
// }, {
// hash: '4624d605004fc7eb9f14ca9c5a226fe3',
// title: { zh: 'lazy 修饰符', en: '' },
// screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
// }, {
// hash: '4624d605004fc7eb9f14ca9c5a226fe3',
// title: { zh: 'trim 修饰符', en: '' },
// screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
// }, {
// hash: '4624d605004fc7eb9f14ca9c5a226fe3',
// title: { zh: 'number 修饰符', en: '' },
// screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}]
}, {
type: 'v-once',
name: 'v-once',
title: { zh: '一次性渲染(v-once)', en: 'v-once' },
desc: {
zh: '只渲染元素和组件一次。随后的重新渲染,元素/组件及其所有的子节点将被视为静态内容并跳过。这可以用于优化更新性能。',
en: 'Render the element and component once only. On subsequent re-renders, the element/component and all its children will be treated as static content and skipped. This can be used to optimize update performance.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/api/#v-once',
en: 'https://vuejs.org/v2/api/#v-once'
},
examples: [{
hash: 'db5a71d3f621f32261a4208943358092',
title: { zh: '使用 v-once', en: 'Using v-once' },
screenshot: 'https://gw.alicdn.com/tfs/TB1dcTaewMPMeJjy1XdXXasrXXa-540-844.png'
}, {
hash: 'f66f49ad00f58ab8bd1fa580d27900f8',
title: {
zh: '不使用 v-once',
en: 'Without v-once'
},
screenshot: 'https://gw.alicdn.com/tfs/TB1cITaewMPMeJjy1XdXXasrXXa-540-844.png'
}]
}, {
type: 'filters',
name: 'Filters',
title: { zh: '过滤器(Filters)', en: 'Filters' },
desc: {
zh: 'Vue.js 允许你自定义过滤器,可被用作一些常见的文本格式化。过滤器可以用在两个地方:mustache 插值和 v-bind 表达式。过滤器应该被添加在 JavaScript 表达式的尾部,由“管道”符指示。',
en: 'Vue.js allows you to define filters that can be used to apply common text formatting.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/filters.html',
en: 'https://vuejs.org/v2/guide/filters.html'
},
examples: [{
hash: '28df0a4424a9e9fe1411020de20d52c0',
title: { zh: '最简例子', en: 'Sample' },
screenshot: 'https://gw.alicdn.com/tfs/TB1U8nAdr_I8KJjy1XaXXbsxpXa-540-844.png'
}, {
hash: 'b4eac5ccef8ef954858e9ef0c6aca9d7',
title: { zh: '传递额外参数', en: 'Pass Arguments' },
screenshot: 'https://gw.alicdn.com/tfs/TB1SV_adBfH8KJjy1XbXXbLdXXa-540-844.png'
}, {
hash: '7b4a2ee438abe343b0a2f38556e730f1',
title: { zh: '过滤器串联', en: 'Chained Filters' },
screenshot: 'https://gw.alicdn.com/tfs/TB1lETpdxrI8KJjy0FpXXb5hVXa-540-844.png'
}]
}, {
type: 'mixins',
name: 'Mixins',
title: { zh: '混合(Mixins)', en: 'Mixins' },
desc: {
zh: '混合 (mixins) 是一种分发 Vue 组件中可复用功能的非常灵活的方式。混合对象可以包含任意组件选项。以组件使用混合对象时,所有混合对象的选项将被混入该组件本身的选项。',
en: 'Mixins are a flexible way to distribute reusable functionalities for Vue components. A mixin object can contain any component options. When a component uses a mixin, all options in the mixin will be “mixed” into the component’s own options.'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/mixins.html',
en: 'https://vuejs.org/v2/guide/mixins.html'
},
examples: [{
hash: 'c69cb31319ffe8e0b25543cfabcf06d6',
title: { zh: '最简例子', en: 'Sample' },
screenshot: 'https://gw.alicdn.com/tfs/TB1HJHcdtfJ8KJjy0FeXXXKEXXa-540-844.png'
}, {
hash: '804d427a56528c3dc2706e77b93df516',
title: { zh: '全局混合', en: 'Global Mixin' },
screenshot: 'https://gw.alicdn.com/tfs/TB1HJHcdtfJ8KJjy0FeXXXKEXXa-540-844.png'
}, {
hash: '92ab52525cb0d7d55d1ef007df90cf77',
title: { zh: '生命周期混合', en: 'Lifecycle Mixin' },
screenshot: 'https://gw.alicdn.com/tfs/TB1bRLCdwDD8KJjy0FdXXcjvXXa-540-844.png'
}, {
hash: 'ee84c44bb3f4b23f83d52aecad30f8ea',
title: { zh: '选项合并', en: 'Mixin Options' },
screenshot: 'https://gw.alicdn.com/tfs/TB1FUTpdxrI8KJjy0FpXXb5hVXa-540-844.png'
}]
}, {
type: 'component',
name: { zh: '组件', en: 'Component' },
title: { zh: '组件', en: 'Component' },
desc: {
zh: '组件系统是 Vue 的另一个重要概念,因为它是一种抽象,允许我们使用小型、独立和通常可复用的组件构建大型应用。仔细想想,几乎任意类型的应用界面都可以抽象为一个组件树。',
en: 'The component system is another important concept in Vue, because it’s an abstraction that allows us to build large-scale applications composed of small, self-contained, and often reusable components. If we think about it, almost any type of application interface can be abstracted into a tree of components'
},
docLink: {
zh: 'https://cn.vuejs.org/v2/guide/index.html#组件化应用构建',
en: 'https://vuejs.org/v2/guide/#Composing-with-Components'
},
examples: [{
hash: '59aeb1600ee976ea61faf354a9fee299',
title: { zh: '使用子组件', en: 'Composing Components' },
screenshot: 'https://gw.alicdn.com/tfs/TB12KPGbS_I8KJjy0FoXXaFnVXa-540-844.png'
}, {
hash: '3373a87306d0e0ccf463ac492aeb070c',
title: { zh: '传递属性', en: 'Passing Data with Props' },
screenshot: 'https://gw.alicdn.com/tfs/TB12KPGbS_I8KJjy0FoXXaFnVXa-540-844.png'
}, {
hash: 'b2ac35b0cc13c4c64c5adbfbeed5b3f7',
title: { zh: '子组件的引用', en: 'Child Component Refs' },
screenshot: 'https://gw.alicdn.com/tfs/TB12KPGbS_I8KJjy0FoXXaFnVXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '多层子组件', en: 'Deep Composed Components' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '生命周期', en: 'Lifecycles' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '注册全局组件', en: 'Global Registration' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: '4c2eadc3fe105d643cd0ade59b3bde54',
title: { zh: '递归组件', en: 'Recursive Components' },
screenshot: 'https://gw.alicdn.com/tfs/TB1U868icrI8KJjy0FhXXbfnpXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '异步组件', en: '' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '内联模板', en: '' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}]
}, {
type: 'built-in',
name: { zh: '内置组件', en: 'Built-in' },
title: { zh: '内置组件', en: 'Built-in Components' },
examples: [{
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '动态组件 <component>', en: 'Dynamic Components' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '用 <slot> 分发内容', en: 'Content Distribution with Slots' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: '4624d605004fc7eb9f14ca9c5a226fe3',
title: { zh: '单个 solt', en: 'Single Slot' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '具名 slot', en: 'Named Slot' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '<transition>', en: '<transition>' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '<transition-group>', en: '<transition-group>' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
// }, {
// hash: 'ccefdea9e9ef695acca7fb1b439277e2',
// title: { zh: '<keep-alive>', en: ' <keep-alive>' },
// screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}]
}, {
type: 'communication',
name: { zh: '组件通信', en: 'Communication' },
title: { zh: '组件通信', en: 'Component Communication' },
examples: [{
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '自定义事件', en: 'Custom Events' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '父子组件通信', en: 'Parent-Child Communication' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '表单组件传值', en: 'Form Components' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}, {
hash: 'ccefdea9e9ef695acca7fb1b439277e2',
title: { zh: '非父子组件通信', en: 'Non Parent-Child Communication' },
screenshot: 'https://gw.alicdn.com/tfs/TB1sF_CcMMPMeJjy1XcXXXpppXa-540-844.png'
}]
}]
}