VScode生成自定义Vue3模板

在学习Vue3时,VScode没有一键生成模板的快捷方式,这就需要我们自己设置一个模板.

步骤:

  1. 点击文件 ----> 首选项 ----> 配置用户代码片段
    在这里插入图片描述
  2. 弹出框中输入vue.json
    在这里插入图片描述
  3. 然后就可以配置你想要的模板啦~
{
	// 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": "vue3",
		"body": [
			"<script lang=\"ts\" setup>",
			"$1",
			"</script>",
			"<template>",
			"$2",
			"</template>",
			"<style lang=\"less\" scoped>",
			"$3",
			"</style>"
		],
		"description": "vue3"
	}
}

模板展示

在这里插入图片描述

posted @ 2022-07-19 15:22  Tricia11  阅读(445)  评论(0)    收藏  举报  来源