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() } } } })