Skip to content

Commit 843fab7

Browse files
committed
fix:支付宝小程序 showLoading无法隐藏问题
1 parent cfaf6d2 commit 843fab7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pages/API/show-loading/show-loading.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
<view class="uni-padding-wrap">
55
<view class="uni-btn-v">
66
<button class="btn-load" type="primary" @click="showLoading">显示 loading 提示框</button>
7+
<!-- #ifndef MP-ALIPAY -->
78
<button @click="hideLoading">隐藏 loading 提示框</button>
9+
<!-- #endif -->
810
</view>
911
</view>
1012
</view>
@@ -21,10 +23,22 @@
2123
uni.showLoading({
2224
title: 'loading'
2325
});
26+
27+
// #ifdef MP-ALIPAY
28+
this._showTimer && clearTimeout(this._showTimer);
29+
this._showTimer = setTimeout(() => {
30+
this.hideLoading();
31+
}, 3000)
32+
// #endif
2433
},
2534
hideLoading: function() {
2635
uni.hideLoading();
2736
}
37+
},
38+
onUnload() {
39+
// #ifdef MP-ALIPAY
40+
this._showTimer && clearTimeout(this._showTimer);
41+
// #endif
2842
}
2943
}
3044
</script>

0 commit comments

Comments
 (0)