每次新建文件总是要重新写一遍初始模板,所以自己配置下,避免重复劳动
- 前提: Mac + VScode + Vue项目 + Pug/Ts/Sass
1. Code > Preferences > User Snippets
.2. 选择需要定义的文件
3.配置JSON
{
"vue": {
"prefix": "vue", // 快捷指令
"body": [
"<template lang='pug'>\n",
"</template>\n",
"<script lang='ts'>",
"import { Component, Vue } from 'vue-property-decorator'\n",
"@Component",
"export default class $1 extends Vue {",
"}\n",
"</script>\n",
"<style lang='scss' scoped>\n",
"</style>\n"
],
"description": "Vue Template"
}
}
4. 在Vue文件中输入vue
,然后按tab
或者enter
搞定!
网友评论