Web Developer

Vscode新建vue模板

2018-07-24  本文已影响0人  夏夏夏夏顿天

每次都需要写入相同的东西,很麻烦,可以利用vscode用户代码片段,然后提高效率

第一部

image.png

在用户代码片段搜索vue,在vue.json里面贴上下面的代码

{
    /*
    // 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"
    }
*/
    "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\" rel=\"stylesheet/stylus\">\n",
            " ",
            "</style>",
            "$2"
        ],
        "description": "Log output to console"
    }
}

保存好

第二步

新建vue文件

在文件内输入vue,就有提示

QQ20180724-162211-HD.gif

个人微信号:2817062995
欢迎交流,记得加我备注:简书哦

上一篇下一篇

猜你喜欢

热点阅读