“vue-router.mjs:3441 TypeError:l.then is not a function”如何修复此问题

vjrehmav  于 2023-05-18  发布在  Vue.js
关注(0)|答案(1)|浏览(312)

我正在做一个培训计划。我用vue3编写了这个培训程序的前端。我开始在我的代码中得到错误下面构建,这是运行良好的localhost。如果你能帮我改正这些错误,我将不胜感激。
控制台:Console image
Router.js:

import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";

const routes = [
  {
    path: "/",
    name: "home",
    component: HomeView,
  },
  ...
  {
    path: "/dashboard",
    name: "dashboard",
    component: () => require("../views/DashboardView.vue"),
    children: [...]
  }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;

package.json:

"dependencies": {
    "@formkit/auto-animate": "^1.0.0-beta.3",
    "@kyvg/vue3-notification": "^2.4.1",
    "axios": "^1.1.2",
    "chart.js": "^3.9.1",
    "maska": "^1.5.0",
    "register-service-worker": "^1.7.2",
    "vue": "^3.2.13",
    "vue-axios": "^3.4.1",
    "vue-chartjs": "^4.1.2",
    "vue-router": "^4.0.3",
    "vuex": "^4.0.0"
  },
rqqzpn5f

rqqzpn5f1#

您应该检查您的导入路由器文件。在我的例子中,我在import中得到了额外的回调:()=> SalesView,你应该忽略它:
从“@/pages/sales”导入SalesView;
export const路由器:RouteRecordRaw[] = [ { path:“/sales”,名称:“销售”,组件:SalesView, meta:{ requiresAuth:},};

相关问题