修改位置
打开vscode首选项-用户片段,可以搜索已有的文件名,或者新建一个json文件。
创建自定义模版
{
"Print to console": {
"prefix": "ybase",
"body": [
"<template>",
" <div>",
" <!-- Page -->",
" </div>",
"</template>",
"<script lang=\"ts\">",
"import { Vue, Component } from \"vue-property-decorator\";",
"",
"@Component({})",
"export default class NAME extends Vue {",
" // component",
"}",
"</script>",
"<style lang=\"scss\">",
"// style",
"</style>",
""
],
"description": "YBASE"
}
}
使用方法
以上我创建的是快速创建vue文件模版。
新建页面后,通过配置的快捷指令“ybase”即可快速生成页面代码。