1.用快捷Ctrl + Shift + P唤出控制台
输入"Snippets"并选择 Snippets: Configure User Snippets
2.输入vue,选中vue.json
vs code自动生成vue.json文件
3.在 vue.json 中添加模板
{
"Print to console": {
"prefix": "vue2",
"body": [
"<template>",
" <div></div>",
"</template>",
"",
"<script>",
"export default {",
" components: {},",
" props: {},",
" data() {",
" return {",
" };",
" },",
" watch: {},",
" computed: {},",
" methods: {},",
" created() {},",
" mounted() {}",
"};",
"</script>",
"<style lang=\"less\" scoped>",
"</style>"
],
"description": "A vue file template"
}
}
4.新建一个 vue 文件,输入"vue2",按下回车键,自动生成模板