我想这样组织我的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((}},}]}]