VScode中Vue快速生成代码片段 [VScode Vue tab 生成代码片段 ]
首先我们要找到设置(如下图)用户代码片段
然后我们会看到这样一个框,然后搜索html.json
如果原来在html.json里没设置过就是一些注释掉的东西,你可以把里面的代码全部删除,然年复制下面的代码就可以了!
然后新建一个html,输入ve 然后tab一下就可以了
{
"vue代码": {
"prefix": "ve",
"body": [
"<!DOCTYPE html>",
"",
"<html lang='en'>",
"<head>",
"\t<meta charset=\"UTF-8\">",
"\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
"\t<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">",
"\t<title>Document</title>",
"\t<script src=\"./vue.js\"></script>",
"</head>",
"",
"<body>",
"\t<div id=\"box\"> </div>",
// "\t</div>",
"\t<script>",
" \t\tvar vm = new Vue({",
"\t\t\tel : '#box',",
"\t\t\tdata : { ",
"\t\t",
"\t\t\t},",
"\t\t\tmethods : { ",
"\t\t",
" \t\t\t}",
"\t\t});",
"\t</script>",
"</body>",
"",
"</html>"
]
}
}