function ajax(url, time, cb) {
// 在 ajax中添加请求事件
const config = window.loadingForAjax.startAjax({ url })
setTimeout(function () {
window.loadingForAjax.stopAjax(config)
typeof cb === 'function' && cb()
}, time)
}
// 加载插件
Vue.use(window.loadingForAjax.default)
new Vue({
el: '#app',
data: {},
methods: {
sendAjax1() {
ajax('sendAjax1', 3000)
},
sendAjax2() {
ajax('sendAjax2', 3000)
}
}
})