相关疑难解决方法(0)

如何解决vue中避免冗余导航到当前位置错误?

我是 vue 新手,在用户登录并重定向到另一条路线后出现错误。基本上我是一名 PHP 开发人员,我在 vue 中使用 laravel。请帮我解决这个错误。

未捕获(承诺)错误:避免了到当前位置的冗余导航:“/admin”。

这里也是截图

在此处输入图片说明

代码

 methods: {
        loginUser() {
            var data = {
                email: this.userData.email,
                password: this.userData.password
            };
            this.app.req.post("api/auth/authenticate", data).then(res => {
                const token = res.data.token;
                sessionStorage.setItem("chatbot_token", token);
                this.$router.push("/admin");
            });
        }
    }
Run Code Online (Sandbox Code Playgroud)

Vue 路线

const routes = [
    {
        path: "/admin",
        component: Navbar,
        name: "navbar",
        meta: {
            authGuard: true
        },
        children: [
            {
                path: "",
                component: Dashboard,
                name: "dashboard"
            },
            {
                path: "users",
                component: Users,
                name: "user"
            }
        ]
    },
    {
        path: "/login",
        component: …
Run Code Online (Sandbox Code Playgroud)

vue.js

48
推荐指数
7
解决办法
6万
查看次数

标签 统计

vue.js ×1