loading.js 413 B

12345678910111213141516171819202122232425
  1. class Loading {
  2. constructor() {
  3. this.load_arr = []
  4. }
  5. showLoading(options) {
  6. if (!this.load_arr.length) {
  7. options ? wx.showLoading({
  8. ...options
  9. }) : wx.showLoading()
  10. }
  11. this.load_arr.push(true)
  12. }
  13. hideLoading(options) {
  14. this.load_arr.pop();
  15. if (!this.load_arr.length) {
  16. options ? wx.hideLoading({
  17. ...options
  18. }) : wx.hideLoading()
  19. }
  20. }
  21. }
  22. module.exports = {
  23. Loading: Loading
  24. }