Routes Vue 2/VueRouter:can';在子路由上时不刷新页面

Routes Vue 2/VueRouter:can';在子路由上时不刷新页面,routes,vuejs2,vue.js,Routes,Vuejs2,Vue.js,当我在子路径上导航时(在上面的示例中http:///applis),然后刷新页面=>我有一个 找不到//在此服务器上找不到请求的URL/applis 也许我还不了解儿童路线的基本概念 在您的情况下,似乎错误的是,当您已经有一个/login路由时,却有一个带有/的父路由。它也是/的子对象。正如政府所说: 以/开头的嵌套路径将被视为根路径。这允许您利用组件嵌套,而不必使用嵌套URL 您可以通过一个示例了解如何创建嵌套管线。此链接中的示例代码: const router = new VueRouter

当我在子路径上导航时(在上面的示例中
http:///applis
),然后刷新页面=>我有一个

找不到//在此服务器上找不到请求的URL/applis


也许我还不了解儿童路线的基本概念

在您的情况下,似乎错误的是,当您已经有一个
/login
路由时,却有一个带有
/
的父路由。它也是
/
的子对象。正如政府所说:

以/开头的嵌套路径将被视为根路径。这允许您利用组件嵌套,而不必使用嵌套URL

您可以通过一个示例了解如何创建嵌套管线。此链接中的示例代码:

const router = new VueRouter({
  routes: [
    { path: '/user/:id', component: User,
      children: [
        // UserHome will be rendered inside User's <router-view>
        // when /user/:id is matched
        { path: '', component: UserHome },

        // UserProfile will be rendered inside User's <router-view>
        // when /user/:id/profile is matched
        { path: 'profile', component: UserProfile },

        // UserPosts will be rendered inside User's <router-view>
        // when /user/:id/posts is matched
        { path: 'posts', component: UserPosts }
      ]
    }
  ]
})
const路由器=新的VueRouter({
路线:[
{path:'/user/:id',组件:user,
儿童:[
//UserHome将在用户的
//当/user/:id匹配时
{路径:'',组件:UserHome},
//UserProfile将在用户的
//当/user/:id/profile匹配时
{path:'profile',组件:UserProfile},
//UserPosts将在用户的
//当/user/:id/posts匹配时
{path:'posts',组件:UserPosts}
]
}
]
})
如果您可以创建一个小提琴与您的更改,这将有助于提供准确的修复

const router = new VueRouter({
  routes: [
    { path: '/user/:id', component: User,
      children: [
        // UserHome will be rendered inside User's <router-view>
        // when /user/:id is matched
        { path: '', component: UserHome },

        // UserProfile will be rendered inside User's <router-view>
        // when /user/:id/profile is matched
        { path: 'profile', component: UserProfile },

        // UserPosts will be rendered inside User's <router-view>
        // when /user/:id/posts is matched
        { path: 'posts', component: UserPosts }
      ]
    }
  ]
})