#第一步:添加用户代码片段
打开 vsocde 的 首选项 > 用户代码片段 ,输入vue,选择代码片段文件为 vue.json。输入以下内容。
"Vue component": {
"prefix": "vuec",
"body": [
"<template>",
" <div>",
" </div>",
"</template>",
"<script>",
"export default {",
" name: '',",
" data() {",
" return {}",
" },",
" components: {},",
" computed: {},",
" beforeMount() {},",
" mounted() {},",
" methods: {},",
" watch: {},",
"}",
"</script>",
"<style scoped>",
"</style>",
""
]
}
#第二步:添加配置
进入 文件 --> 首选项 --> 设置 —> 添加这2项
// Specifies the location of snippets in the suggestion widget
"editor.snippetSuggestions": "top",
// Controls whether format on paste is on or off
"editor.formatOnPaste": true
#第三步:重启vscode
#第四步:新建app.vue,键入vue,按下回车键