如何重定向到vue路由器中带有params的路由器



我想这样组织我的Vue路由器:

重定向到
原始URL
exmple.com/ exmple.com/en/home
exmple.com/:lang exmple.com/:lang/home(:lang是一种参数意义的语言(
example.com/:lang/home :lang主页
example.com/:lang/result/:date 日期的结果页
example.com/:lang/result exmaple.com/:lang/result/current_date(current_date可视为new Date()(
模式:'历史',路线:[{路径:"/",//重定向:'/en/home',//将默认值设置为lang-baseurl重定向:((=>{return'/en'}}{路径:'/:lang',名称:"lang",//component:((=>导入("./Frame.vue"(,组件:{template:",//如果Frame.vue中没有特殊代码},//重定向:{name:"home"},重定向:到=>({路径:'/'+to.params.lang+'/home',//传递的用户lang:lang}),儿童:[{路径:"home",name:"家",component:((=>导入("./components/Home.vue"(}{路径:'结果/:日期',name:"结果",component:((=>导入("./components/ResultDay.vue"(}{路径:"result",redirect:{name:"result",params:{date:new date((}},}]}]

最新更新