@@ -108,9 +108,9 @@ vue ui
108
108
module .exports = {
109
109
pages: {
110
110
index: {
111
- entry: " site/main.js"
112
- }
113
- }
111
+ entry: " site/main.js" ,
112
+ },
113
+ },
114
114
};
115
115
```
116
116
@@ -123,7 +123,7 @@ module.exports = {
123
123
124
124
<script>
125
125
export default {
126
- name: "Home"
126
+ name: "Home",
127
127
};
128
128
</script>
129
129
```
@@ -149,13 +149,13 @@ export default {
149
149
export default {
150
150
name: " VButton" ,
151
151
props: {
152
- text: String
152
+ text: String ,
153
153
},
154
154
methods: {
155
155
handleClick (event ) {
156
156
this .$emit (" click" , event );
157
- }
158
- }
157
+ },
158
+ },
159
159
};
160
160
</script >
161
161
@@ -195,7 +195,7 @@ export default {
195
195
``` javascript
196
196
import Button from " ./src/button" ;
197
197
198
- Button .install = Vue => {
198
+ Button .install = ( Vue ) => {
199
199
Vue .component (Button .name , Button);
200
200
};
201
201
@@ -209,14 +209,14 @@ import Button from "./button/index.js";
209
209
210
210
const components = [Button];
211
211
212
- const install = Vue => {
213
- components .forEach (component => {
212
+ const install = ( Vue ) => {
213
+ components .forEach (( component ) => {
214
214
Vue .use (component);
215
215
});
216
216
};
217
217
218
218
export default {
219
- install
219
+ install,
220
220
};
221
221
```
222
222
@@ -258,16 +258,16 @@ Vue.use(VueUIDocs);
258
258
export default {
259
259
data () {
260
260
return {
261
- showCode: false
261
+ showCode: false ,
262
262
};
263
263
},
264
264
computed: {
265
265
codeIconSrc () {
266
266
return this .showCode
267
267
? " https://gw.alipayobjects.com/zos/rmsportal/wSAkBuJFbdxsosKKpqyq.svg"
268
268
: " https://gw.alipayobjects.com/zos/rmsportal/wSAkBuJFbdxsosKKpqyq.svg" ;
269
- }
270
- }
269
+ },
270
+ },
271
271
};
272
272
</script >
273
273
@@ -378,7 +378,7 @@ module.exports = function(source) {
378
378
return ` <pre class="hljs"><code>${ markdownIt .utils .escapeHtml (
379
379
str
380
380
)} </code></pre>` ;
381
- }
381
+ },
382
382
});
383
383
// 解析【:::tip:::】
384
384
markdownIt .use (MarkdownItContainer, " tip" );
@@ -408,13 +408,13 @@ module.exports = function(source) {
408
408
let { template, script, styles } = parse ({
409
409
source: content,
410
410
compiler: VueTemplateComplier,
411
- needMap: false
411
+ needMap: false ,
412
412
});
413
413
styleCodeList = styleCodeList .concat (styles);
414
414
// 将template的转为render函数
415
415
const { code } = compileTemplate ({
416
416
source: template .content ,
417
- compiler: VueTemplateComplier
417
+ compiler: VueTemplateComplier,
418
418
});
419
419
// 获取script的代码
420
420
script = script ? script .content : " " ;
@@ -445,7 +445,7 @@ module.exports = function(source) {
445
445
}
446
446
return ` </div>
447
447
</vc-snippet> ` ;
448
- }
448
+ },
449
449
});
450
450
// 将所有转换好的代码字符串拼接成vue单组件template、script、style格式
451
451
return `
@@ -464,7 +464,7 @@ module.exports = function(source) {
464
464
}
465
465
</script>
466
466
<style lang='scss'>
467
- ${ Array .from (styleCodeList, m => m .content ).join (" \n " )}
467
+ ${ Array .from (styleCodeList, ( m ) => m .content ).join (" \n " )}
468
468
</style>` ;
469
469
};
470
470
```
@@ -476,10 +476,10 @@ module.exports = {
476
476
pages: {
477
477
index: {
478
478
// 入口文件
479
- entry: " site/main.js"
480
- }
479
+ entry: " site/main.js" ,
480
+ },
481
481
},
482
- chainWebpack : config => {
482
+ chainWebpack : ( config ) => {
483
483
// 解析Markdown文件转成vue组件
484
484
config .module
485
485
.rule (" md" )
@@ -488,14 +488,14 @@ module.exports = {
488
488
.loader (" vue-loader" )
489
489
.options ({
490
490
compilerOptions: {
491
- preserveWhitespace: false
492
- }
491
+ preserveWhitespace: false ,
492
+ },
493
493
})
494
494
.end ()
495
495
.use (" markdown-loader" )
496
496
.loader (require (" path" ).resolve (__dirname , " ./build/markdown-loader.js" ))
497
497
.end ();
498
- }
498
+ },
499
499
};
500
500
```
501
501
@@ -550,8 +550,8 @@ module.exports = {
550
550
methods: {
551
551
handleButtonClick() {
552
552
alert(1);
553
- }
554
- }
553
+ },
554
+ },
555
555
};
556
556
</script>
557
557
```
0 commit comments