【问题标题】:Vue router, the page doesn't work after changing the pathVue路由器,更改路径后页面不工作
【发布时间】:2019-01-30 13:36:06
【问题描述】:

我遇到了问题,每当我更改 vue.config.js 和 vue-router 中的路径时,页面在 XAMMP 中的本地服务器上都不起作用。我已经更改了 publicPath 和 outputPath。

更多细节在这里,我把这个链接,因为没有人回应。 在下面的链接中,还有一个指向 GitHub 上的存储库的链接:

https://forum.vuejs.org/t/problem-with-vue-routing-on-vue-cli-3-content-doesnt-show-in-the-different-path/55000

感谢您的帮助。我在这里堆得很糟糕。

【问题讨论】:

  • 在使用 vue-router 时,你还需要在路由器的索引文件中设置路由器基本属性。你这样做了吗? const router = new Router({ mode: 'history', base: /foldername } )
  • 所以如果我将 publicPath 选为 /ninja-custom/app/
  • 我必须把 base: / 或 base: /ninja-custom/app/
  • 设置为 base:/ninja-custom/app 并且不要忘记再次构建以检查结果。
  • 帮了大忙,非常感谢!

标签: vuejs2 vue-router


【解决方案1】:

在使用 vue-router 时,您还需要在路由器的索引文件中设置路由器基础属性。 你做过吗?? const router = new Router({ mode: 'history', base: /foldername }) 有关更多详细信息,请参阅以下链接: https://router.vuejs.org/api/#base

【讨论】:

    猜你喜欢
    • 2022-11-02
    • 2018-03-26
    • 2019-11-19
    • 1970-01-01
    • 2019-10-24
    • 2019-03-28
    • 2021-07-18
    • 2019-02-22
    • 2021-01-13
    相关资源
    最近更新 更多