vscode,新建vue模板

1、安装插件

Vue 2 Snippets    //快速新建vue页面

2、 添加配置,让vscode允许自定义的代码片段提示出来,文件 –> 首选项 –> 设置 —> 添加如下2项:

// Specifies the location of snippets in the suggestion widget
"editor.snippetSuggestions": "top",
// Controls whether format on paste is on or off
"editor.formatOnPaste": true

3、新建模板并保存,文件 –> 首选项 –> 用户代码片段 –> 输入vue,选择vue.json –>复制粘贴如下内容并保存重启vscode

{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<template>",
            " <div class=\"page\">\n",
            " </div>",
            "</template>\n",
            "<script type=\"text/ecmascript-6\">",
            "export default {",
            " data() {",
            " return {\n",
            " }",
            " },",
            " components: {\n",
            " }",
            "}",
            "</script>\n",
            "<style scoped lang=\"stylus\">",
            "</style>",
            "$2"
        ],
        "description": "Log output to console"
    }
}

4、使用,测试是否添加成功:新建**.vue后缀文件,输入vue,按下tab键

发布了26 篇原创文章 · 获赞 3 · 访问量 7941

猜你喜欢

转载自blog.csdn.net/Eva3288/article/details/81662735