vscode vue代码模板

{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<!-- $1 -->",
            "<template>",
            "<div class='$2'>$5</div>",
            "</template>",
            "",
            "<script>",
            "",
            "export default {",
            "components: {},",
            "props: {},",
            "data() {",
            "return {",
            "",
            "};",
            "},",
            "computed: {},",
            "watch: {},",
            "methods: {",
            "",
            "},",
            "created() {},",
            "mounted() {},",
            "beforeCreate() {}, ",
            "beforeMount() {}, ",
            "beforeUpdate() {}, ",
            "updated() {}, ",
            "beforeDestroy() {}, ",
            "destroyed() {}, ",
            "activated() {}, ",
            "}",
            "</script>",
            "<style lang='scss' scoped>",
            "$4",
            "</style>"
        ],
        "description": "生成vue模板"
    },
    "http-get请求": {
    "prefix": "httpget",
    "body": [
        "this.\\$http({",
        "url: this.\\$http.adornUrl(''),",
        "method: 'get',",
        "params: this.\\$http.adornParams({})",
        "}).then(({ data }) => {",
        "})"
    ],
    "description": "httpGET请求"
    },
    "http-post请求": {
    "prefix": "httppost",
    "body": [
        "this.\\$http({",
        "url: this.\\$http.adornUrl(''),",
        "method: 'post',",
        "data: this.\\$http.adornData(data, false)",
        "}).then(({ data }) => { });" 
    ],
    "description": "httpPOST请求"
    }
}

 

文件 ➡ 首选项 ➡ 配置用户代码片段

会弹出搜索框,点击 新代码片段 自己起个名字

posted on 2023-02-07 15:15  苹果园dog  阅读(75)  评论(0编辑  收藏  举报

导航