首页 文章

重新加载页面不会路由到正确的嵌套路由

提问于
浏览
0

当我只有1级路由时,这曾经很好用,但是在有2级后它不起作用 .

我有一个根路由器

{ path: '/', name: 'Index', component: Index, useAsDefault: true },
{ path: '/settings/...', name: 'Settings', component: Settings }

在设置中我有更多的异步路由 .

AsyncRoute {aux: null, path: "./", name: "Overview", data: undefined, useAsDefault: undefined}

等等

当我通过路由链接进行导航时,它可以工作,但是当我在say / settings / user / info重新加载我的页面时,它会从根脚本加载一个空白页面,但是没有任何东西在路由器插座中 .

我该如何解决?是否与指定了相对路径的异步路由有关?

1 回答

  • 1

    我遇到了同样的问题,但我通过在index.html中使用这个代码解决了 . 这是一个APP_BASE_HREF的错误

    <head>
        <base href="/">
        <!-- Set the base href -->
        <script>document.write('<base href="'+ document.location +'"/>');</script>
    </head>
    

相关问题