问题描述访问二级路由组件,仅能显示一级路由引用的组件相关代码//请把代码文本粘贴到下方(请勿用图片代替代码)main.js:importVuefrom'vue'importAppfrom'./App'importrouterfrom'./router'newVue({el:'#app',router,components:{App},template:''})router/index.jsimportVuefrom'vue'importRouterfrom'vue-router'importLoginfrom'@/components/login'importFindpwfrom'@/components/login/findpw'importRegisterfrom'@/components/register'Vue.use(Router)exportdefaultnewRouter({mode:'history',routes:[{path:'/',redirect:'/login'},{path:'*',redirect:'/login'},{path:'/login',name:'Login',component:Login,children:[{path:'/login/findpw',name:'findpw',component:Findpw}]},{path:'/register',name:'Register',component:Register}]})你期待的结果是什么?实际看到的错误信息又是什么?在浏览器中:1、访问/,能够重定向并显示login内容2、访问*和、login和register都能显示对应内容3、期望是访问/login/findpw,显示findpw的组件,但显示的却是它的上级“login”的组件内容求各位前辈解答
添加回答
举报
0/150
提交
取消