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