VS code 设置vue文件模版

进入User Snippets

方法一: File --> Preferences --> User Snippets
VS code 设置vue文件模版_第1张图片
方法二:左下角齿轮 —> User Snippets
VS code 设置vue文件模版_第2张图片

进入设置

User Snippets 里输入vue, 选择 vue.json (有的vscode 版本是vue),进入vue.json进行配置
VS code 设置vue文件模版_第3张图片
VS code 设置vue文件模版_第4张图片
详细配置如下所示

{
	// 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": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"vue template":{
		"prefix":"vue",
		"body":[
			"",
			"",
			""
		],
		"description": "vue template"
	}
}

使用

在新建的vue文件里,输入 vue, 再按回车,即生成模版内容
VS code 设置vue文件模版_第5张图片
VS code 设置vue文件模版_第6张图片

你可能感兴趣的:(IDE)