var publicFnAxios = { post : function(url,data){ return new Promise(function(resolve, reject){ var that = this; data.api_version = ''; Axios.post(url,data).then(function (res) { //判断是否是登录过期==》后台登录过期返回code=1100 if(res.data.code==1100){ sessionStorage.clear(); router.replace({ path: "/" }) } resolve(res); }).catch(function (error) { reject(error); }); }) }, get : function(url,data){ return new Promise(function(resolve, reject){ var that = this; data.api_version = ''; Axios.get(url,data).then(function (res) { //判断是否是登录过期==》后台登录过期返回code=1100 if(res.data.code==1100){ sessionStorage.clear(); router.replace({ path: "/" }) } resolve(res); }).catch(function (error) { reject(error); }); }) },}