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
  • 相关阅读:
    vue.api
    v-resource
    vue.js路由
    computed watch methods
    vue.js生命周期
    flex布局
    字符截取 slice substr substring
    原生Ajax书写
    jq动画
    css 3动画
  • 原文地址:https://www.cnblogs.com/zhangrenjie/p/14137675.html
Copyright © 2011-2022 走看看