自己在写一个模仿登录注册页面的时候,我在组件中如下
this.$axios({
method: 'post',
url: url,
data: {
name: this.name,
password: this.password
},
header: {
'Content-Type': 'x-www-form-urlencoded'
}
})
.then(function (res) {
// console.log(res)
if (res.data.status === 123) {
that.$router.push({name: 'List'})发现红色部分没有跳转成功,于是就到处百度找原因,不经意间注释掉了在main.js中的如下内容:
router.beforeEach((to, from, next) => {
....
}当然既然注释掉了为了不影响页面的功能可以在App.vue中的create阶段,通过条件调用that.$router.push({name: '你组件的名字'})
发现跳转成功了,很神奇,我也不知道为啥,有和我同样问题的不妨试试
版权声明:本文为wangnima666原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。