2020
10-10
10-10
vue路由切换时取消之前的所有请求操作
在main.js文件里importrouterfrom'router/';importVuefrom'vue';Vue.Cancel=[];router.beforeEach((to,from,next)=>{while(Vue.Cancel.length>0){Vue.Cancel.shift()('cancel');}next();})ajax文件importVuefrom'vue';importaxiosfrom'axios';importVueAxiosfrom'vue-axios';Vue.use(VueAxios,axios);//导入封装的回调函数import{cbs,gbs}from'config/';//动态设置本地和线上接口域...
继续阅读 >