axios.defaults.timeout = 10000;
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
axios.defaults.baseURL = 'https://www.easy-mock.com/mock/5c6b6b1815b74a0aacc7a902/xyy';
2.解决方案:
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
3.解决vuex调用数据更新不及时的问题(刷新页面,页面数据才会更新)
原因:问答:vuex数据更新的问题
vue官方解释
解决方案:
//.vue
<span class="phone">{{phone}}</span>
//script
computed:{
...mapGetters([ "getPhone"]),
phone(){
return this.getPhone
},
}