zoukankan      html  css  js  c++  java
  • 多个请求下 loading 的展示与关闭

    data () {
      return {
         loadingCount: 0,
    isShowLoading: false
    } }

    methods: {
      addLoading() {
        this.loadingCount++
        this.isShowLoading = true
      },
      isCloseLoading() {
           this.loadingCount--
           if (this.loadingCount == 0) {
               this.isShowLoading = false
           }
       },
      getData1 () {
        this.addLoading = true
        axios.get('').then(res => {
          this.isCloseLoading()
        }).catch(err => {
          this.loadingCount = 0
          this.isShowLoading = false
        })
      },
     getData2 () {
       this.addLoading = true
       axios.get('').then(res => {
         this.isCloseLoading()
       }).catch(err => {
         this.loadingCount = 0
         this.isShowLoading = false
       })
     }
    }
    loadingCount
  • 相关阅读:
    HTML5学习记录
    CSS学习记录
    HTML扩展(thead,tbody,tfoot标签的使用)
    测删除功能
    jmeter-连接数据库
    jmeter-正则表达式提取器
    jmeter常用函数
    java基础(二)
    git基本使用
    波特的钻石模型
  • 原文地址:https://www.cnblogs.com/zhangrenjie/p/14137675.html
Copyright © 2011-2022 走看看