1234567891011121314151617181920212223242526272829 |
- function startLoading () {
- uni.showLoading({
- mask:true
- })
- }
- // 关闭loading事件
- function endLoading () {
- uni.hideLoading()
- }
- // 默认状态
- let needLoadingRequestCount = 0
- // 开启loading
- export function showFullScreenLoading() {
- if (needLoadingRequestCount === 0) {
- startLoading()
- }
- needLoadingRequestCount++
- }
- // 取消loading
- export function tryHideFullScreenLoading() {
- if (needLoadingRequestCount <= 0) return
- needLoadingRequestCount--
- if (needLoadingRequestCount === 0) {
- endLoading()
- }
- }
|