rah*_*hul 2 javascript vue.js vue-router
我正在使用具有历史模式的 Vue 路由器。在按钮上单击当前页面,我将其路由到下一页。在第二页上,当我重新加载时,我收到 404。有没有办法在 Vue 中处理这个问题并将其重定向到主页。
export default new Router({
mode: "history",
routes: [
{
path: "/",
name: "first",
component: First
},
{
path: "/abc",
name: "abc",
component: Second,
props: true
},
Run Code Online (Sandbox Code Playgroud)
您可以使用历史模式内嵌的哈希模式来解决路由器上的问题
let router = new Router({
mode: "hash",
routes: [
{
//and the urls with path on here ...Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11072 次 |
| 最近记录: |