vscode Vue ts 自定义模板
- 首先打开vscode选择用户片段
- 选择vue.json
{
// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"vue-ts": {
"prefix": "!vue-ts",
"body": [
"<!-- 组件用途 -->",
"<template>",
" <div></div>",
"</template>",
"",
"<script lang='ts'>",
"import { Component, Vue } from 'vue-property-decorator';",
"",
"@Component",
"export default class Name extends Vue {",
" created() {}",
"}",
"</script>",
"<style lang='scss' scoped></style>"
],
"description": "vue ts 基础模板"
}
}
输入对应的模板
prefix 选项里面就是调起现因的命令,如下
这样就ok拉~~~~~~