1 router 环境
两个router嵌套: bookRouter -> chapterRouter 对应URL为: /book/chapter
其中chapterRouter配置了redirect, 到page0组件,url为 /book/chapter/page0
path: '/chapter',
redirect: 'chapter/page0',
2 router client环境:
在非上述router的页面, 如 /trial 页面,点击页面button试读,并传递参数 doc (是个js Object)
this.$router.push({name: 'chapterRouter', params: {doc: this.doc}})
3 运行问题
在 bookRouter 、chapterRouter、Page0 组件的mounted 函数都尝试接受param, 但都收不到:
mounted: function () {
console.info('mounted')
console.info(this.$route.params.doc)
}
4 正常情况.
但是,如果chapterRouter没有设置redirect, bookRouter 和 chapterRouter mounted 都能收到 doc object参数