退出登录后,重新登录显示404
src/layout/components/Navbar.vue
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/hospital/index';
//注意这一行,要写成 location.href 不能写 router.push
})
}).catch(() => {});
}
}