VSCode快速生成Vue组件模板

715 阅读1分钟

说明:在我们运用VSCode进行日常Vue开发时,可以使用定制模板来进行快速开发。

1.找到Vue模板编辑的json

打开VSCode编译器 => 点击文件 => 首选项 => 用户片段 => 在弹出的搜索框中搜索vue.json => 打开json文件!

2.输入你自定义的模板代码

{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<!-- $1 -->",
            "<template>",
        	"	<div class = '$2'>"
                    "$5"
            "   </div>",
            "</template>",
            "",
            "<script>",
            "export default {",
            "	data() {",
            "		return {",
            "			",
            "		}",
            "	},",
			"	components: {"
			"		",
			"	},",
            "	methods: {",
            "		",
            "	}",
			"}"
            "</script>",
			"",
            "<style lang='scss' scoped>",
            "	$4",
            "</style>"
        ],
        "description": "Log output to console"
    }
}

3.保存成功后,进入.vue文件进行测试,输入vue

VSCode里Vue的模板生成

VSCode里Vue模板生成

水平有限,还不能写到尽善尽美,希望大家多多交流,跟春野一同进步!!!