问题描述:在测试接口的时候axios中this.$router.push跳转路由不起作用
解决方法:在.then中加上.bind(this)改变this的指向
axios
.post("/login", param)
.then(function(response) {
//成功则返回成功的值
console.log(response);
this.$router.push("/");
}.bind(this)).catch(function(error) {
console.log(error);
});
问题解决