1***@qq.com
1***@qq.com
  • 发布:2023-08-25 15:00
  • 更新:2023-08-25 15:44
  • 阅读:363

uni小程序SDK集成之后,再第二次加载后loading加载框会一直展示。

分类:uni小程序sdk
getPage(msg) {  
                uni.showLoading({  
                    title: msg,  
                    mask: true  
                })  
                this.$http.get(this.$api.url.notice.getPageList, this.page.query).then(res => {  
                    uni.hideLoading();  
                    uni.stopPullDownRefresh();  
                    if (!res.success) {  
                        uni.showToast({  
                            title: res.message,  
                            icon: 'none'  
                        })  
                        return  
                    }  
                    if (this.page.query.pageNumber == 1) {  
                        this.page.rows = [];  
                    }  
                    this.page.total = res.data.total  
                    this.page.rows = this.page.rows.concat(res.data.rows)  
                }).catch(err=>{  
                    uni.hideLoading();  
                    uni.showToast({  
                        title: err.message,  
                        icon: 'none'  
                    })  
                })  
            },

以上为请求代码,再重复点击后,会出现加载框一直展示不会消失的问题。
下边是错误的视频

2023-08-25 15:00 负责人:无 分享
已邀请:
喜欢技术的前端

喜欢技术的前端 - QQ---445849201

加个 防抖,(●'◡'●)

data() {  
            return {  
                isFlag: true  
            }  
        },  
        methods: {  
            getPag() {  
                if (!this.isFlag) {  
                    return  
                }  
                this.isFlag = false  
                uni.showLoading({  
                    title: msg,  
                    mask: true  
                })  
                this.$http.get(this.$api.url.notice.getPageList, this.page.query).then(res => {  
                    uni.hideLoading();  
                    uni.stopPullDownRefresh();  
                    if (!res.success) {  
                        uni.showToast({  
                            title: res.message,  
                            icon: 'none'  
                        })  
                        return  
                    }  
                    if (this.page.query.pageNumber == 1) {  
                        this.page.rows = [];  
                    }  
                    this.page.total = res.data.total  
                    this.page.rows = this.page.rows.concat(res.data.rows)  

                    this.isFlag = true  

                }).catch(err => {  
                    uni.hideLoading();  
                    uni.showToast({  
                        title: err.message,  
                        icon: 'none'  
                    })  

                    this.isFlag = true  

                })  
            },

要回复问题请先登录注册