【发布时间】:2018-04-27 07:32:48
【问题描述】:
我在路由器文件中删除了带有历史模式的链接中的 hashbang。 现在,当我刷新页面时,我得到了 404 错误。
我尝试关注this link
然后,我在 firebase.json 中添加了部分:
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
然而一切都没有改变。
我不明白为什么我仍然有这个错误。 我尝试了很多东西,但找不到可以解决的问题。
这是我的路由器文件:
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/',
redirect: '/catalog'
},
{
path: '/catalog',
name: 'Catalog',
component: Catalog
},
{
path: '/catalog/category/:category',
name: 'ProductsList',
component: ProductsList
},
{
path: '/catalog/category/:category/product/:id',
name: 'ProductDetail',
component: ProductDetail,
},
{
path: '/catalog/category/:category/product/create',
name: 'CreateProduct',
component: CreateProduct
}
]
});
【问题讨论】:
-
你看到了吗:router.vuejs.org/en/essentials/history-mode.html Taje 看看服务器配置。我遇到了同样的问题,不得不使用此链接上的解决方法。
-
您好,谢谢。是的,我说我用这个链接实现了这个,但没有任何改变:(
-
我认为你的 firebase 配置没有坚持。从我在网上看到的内容来看,重写看起来是正确的。是需要重启服务器,还是firebase文件部署错了地方?
-
是的,它肯定来自 Firebase,但我找不到在哪里。还在继续……
-
firebase 文件也部署在好地方。我在我的 dist/repo 上使用 npm serve 来通过 npm 构建对其进行测试。帮助:'(
标签: firebase vue.js vuejs2 http-status-code-404 vuefire