【备份】自用代码块 - uniapp HBuilderX代码块 - 快捷键 - tab展开 - 标签内容展开

示意图

代码块

HTML代码块

{
    "te": {
        "body": [
            "<text>$0</text>"
        ],
        "prefix": "te",
        "scope": "text.html.basic",
        "triggerAssist": true
    },
    "colc": {
        "body": [
            "<view class=\"colInner\">",
            "    $0",
            "</view>",
        ],
        "prefix": "colc",
        "scope": "text.html.basic",
        "triggerAssist": true
    }
}

javascript代码块

{
    "clog": {
        "prefix": "clog",
        "body": [
            "console.log($1)"
        ],
        "triggerAssist": false
    },
    
    "alertalert": {
        "prefix": "alertalert",
        "body": [
            "this.$$fns.alert('$0')"
        ],
        "triggerAssist": false
    },
    
    "help": {
        "prefix": "help",
        "body": [
            "'Content-Type':'application/x-www-form-urlencoded',"
        ],
        "triggerAssist": false
    },
    
    
    
    "myrequest": {
        "prefix": "myrequest",
        "body": [
            "let d = {",
            "    ",    
            "}",
            "let u = this.$$store.getters.getApiFull + ''",
            "console.log('[提交数据]', JSON.stringify(d))",
            "console.log('[提交地址]', u)",
            "",
            "uni.showLoading({ mask: true })",
            "uni.request({",
            "    url: u,",
            "    method: 'GET',",
            "    dataType: 'JSON',",
            "    header: {",
            "        'Authorization': this.$$store.getters.getToken",
            "    },",
            "    data: d,",
            "    success: (res) => {",
            "        uni.hideLoading()",
            "        console.log('[接口响应]', JSON.stringify(res.data))",
            "        if (res.statusCode != 200) {",
            "            this.$$fns.alert(res.errMsg)",
            "            return",
            "        }",
            "        ",
            "        if (res.data.code != 200) {",
            "            // 自动跳转登录",
            "            this.$$fns.auto_login_redirecting(res.data.msg)",
            "            this.$$fns.alert((res.data.msg != null)? String(res.data.msg) : '[服务器响应] null')",
            "            return",
            "        }",
            "        ",
            "        // 成功",
            "        $0",
            "        ",
            "    },",
            "    fail: (e) => {",
            "        uni.hideLoading()",
            "        this.$$fns.alert('请求失败')",
            "    }",
            "})"
        ],
        "triggerAssist": false
    }
    
}

vue代码块

{
    "view": {
        "prefix": "view",
        "body": [
            "<view>",
            "\t$0",
            "</view>"
        ]
    },
    
    "te": {
        "prefix": "te",
        "body": [
            "<text>$0</text>"
        ]
    },
    "colcol": {
        "prefix": "colcol",
        "body": [
            "<view class=\"colInner\">",
            "\t$0",
            "</view>"
        ]
    },
    "colView": {
        "prefix": "colView",
        "body": [
            "<view class=\"col\">",
            "\t$0",
            "</view>"
        ]
    },
    "col": {
        "prefix": "col",
        "body": [
            "<view class=\"col\">",
            "\t$0",
            "</view>"
        ]
    },
    "imgDemo": {
        "prefix": "imgDemo",
        "body": [
            "<image src=\"/static/img/icons/$0.png\" mode=\"aspectFit\" class=\"img30px\"></image>"
        ]
    },
    "loading": {
        "prefix": "loading",
        "body": [
            "<!-- 数据加载中 -->",
            "<view class=\"sysCoverBoxFullAndCenter\" v-if=\"info === null\">",
            "    <uni-icons type=\"spinner-cycle\" size=\"50\" class=\"opacity20\"></uni-icons>",
            "</view>",
            "",
            "<!-- 数据已加载 -->",
            "<view v-if=\"info !== null\">",
            "$0",
            "</view>"
        ]
    }
}

猜你喜欢

转载自blog.csdn.net/qq285744011/article/details/129548155