VS Code快捷创建代码片段
首先安装插件 vetur
step1:
文件-首选项-用户代码片段,输入vue,点击enter后进入vue.json文件,将下方代码完全覆盖掉以前内容,保存
step2:测试
新进test.vue文件,在vue文件中输入vue,点击table就能自动生成模板了,如果想调整模板内容,在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:
"Print to console": {
"prefix": "vue",
"body": [
"<!-- $1 -->",
"<template>",
" <div></div>",
"</template>",
"",
"<script>",
"export default {",
" name: '$2',",
" data () {",
" return {",
" $0",
" }",
" },",
"",
" components: {},",
"",
" computed: {},",
"",
" mounted: {},",
"",
" methods: {}",
"}",
"</script>",
"<style lang=\"less\" scoped>",
"",
"</style>",
"",
],
"description": "Log output to console"
}
}