服务器修改跳转接口,vue-element登录切换到服务器api后 有返回 但是跳转路由报错...
vue-element本地mock沒有問題,換成線上測試數(shù)據(jù)api后,有數(shù)據(jù)返回但是登陸時彈出提示:Request failed with status code 404,并且報了一堆
index.vue中的登錄代碼:
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
this.$store.dispatch('user/login', this.loginForm).then(() => {
this.$router.push({ path: this.redirect || '/' })
//this.$router.push('/')
this.loading = false
}).catch(() => {
this.loading = false
})
} else {
console.log('error submit!!')
return false
}
})
user.js;
export function login(data) {
return request({
url: '/login/login.php',//換成服務(wù)器的接口
method: 'post',
data
})
}
測試接口返回的數(shù)據(jù):{"code":20000,"data":"admin-token"} 是因為接口返回的數(shù)據(jù)有問題么?
總結(jié)
以上是生活随笔為你收集整理的服务器修改跳转接口,vue-element登录切换到服务器api后 有返回 但是跳转路由报错...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机是怎样知道屏幕位置的,如何看自己的
- 下一篇: html5倒计时秒杀怎么做,vue 设