k94314517
2024-07-29 282ae8b61eed9a9eb81ac85a9c7f6899eb3652fd
wechat_jiaxuan/utils/request.js
@@ -1,10 +1,10 @@
import { baseUrl } from "./config"
import { wxLoginCustomer } from '../api/index'
let number = 0
export function request(options){
  let loading = options.loading || '1' // 默认值1显示,否则不显示
  if(loading == '1'){
    wx.showLoading()
    number ++
  }
  return new Promise(resolve => {
    wx.request({
@@ -40,7 +40,10 @@
      },
      complete() {
        if(loading == '1'){
          wx.hideLoading()
          number --
          if(number == 0){
            wx.hideLoading()
          }
        }
      }
    })