0
点赞
收藏
分享

微信扫一扫

uni-app调用封装的API request代码片段

this.showLoading();
request.post({
    url: this.config.apiList.接口名,
    data: {
        id: this.id
        // 传参
    },
    success: d => {
        if (d.code == 0) {
            // 这里写代码
        } else {
            console.log("失败", d.msg);
        }
    }, complete: d => {
        this.hideLoading();
    }, fail: d => {
        console.log(d);
        // 报错
        this.hideLoading();
    }
});
举报

相关推荐

0 条评论