vscode创建代码模板
首先打开文件—首选项—用户片段
然后找到html.json
接着对html.json写入加的模板
{
"h5 template": { //无关紧要
"prefix": "vue", //触发模板的关键词
"body": [ //每一行都要""
"<!DOCTYPE html>", //结尾需加上 ,
"<html lang=\"en\">", //注意""之间需要\转义字符
"<head>",
"\t<meta charset=\"UTF-8\">", //\n意味着换行,\t是制表符
"\t<title>Title</title>",
"</head>",
"<body>",
"\t<div id=\"app\">",
"\t\t<h2>{{message}}</h2>",
"\t</div>",
"<script src=\"../JS/vue.js\"></script>",
"<script>",
"\tconst app=new Vue({",
"\t\tel:'#app'," ,
"\t\tdata:{ ",
"\t\t\tmessage:\"hello\",",
"\t\t}",
"\t})",
"</script>",
"</body>",
"</html>"
],
"description": "init vue template"//对模板的描述
}
}
保存之后新建html输入触发模板的关键词回车就完成了