欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mac在vscode中新建vue模板

程序员文章站 2022-06-03 10:29:38
...

点击左下角的设置按钮,选择user snippets,

Mac在vscode中新建vue模板

 

在弹出层选择new global snippets file,输入模板名称,回车

Mac在vscode中新建vue模板

 

全选,将以下代码复制到文件中

{
  "Vue-Template": {
    "prefix": "vue",
    "body": [
      "<!DOCTYPE html>",
      "<html lang=\"zh-CN\">\n",
      "<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>Template</title>",
      "\t<script src=\"./js/vue.js\"></script>",
      "</head>\n",
      "<body>",
      "\t<div id=\"app\">$1</div>\n",
      "\t<script>",
      "\t\tconst app = new Vue({",
      "\t\t\tel: '#app',",
      "\t\t\tdata: {},",
      "\t\t\tmethods: {}",
      "\t\t});",
      "\t</script>",
      "</body>\n",
      "</html>"
    ],
    "description": "快速创建vue模板"
  }
}

其中,"\t<script src=\"./js/vue.js\"></script>",是js文件的位置,需要修改为自己的

"prefix": "vue",是我带出这个模板的前缀,可以修改为自己想要的