使用iview-admin,框架是二级菜单,因业务须要改为三级菜单。其余部分都已经改好,可是页面仍然没有出来,页面也没有了报错,比较诡异。
后来发现问题可能在路由配置,看到了别人写的这个demo,连接:https://jsfiddle.net/767nb8u1/1/
能够看到,嵌套组件中的每一级都有component选项,好像是必须的(页面也没有了报错),chidren选项中的component父子两级同时渲染,这确定不是咱们所须要的,知乎有人这样解决的:vue
增长了中间层:artical-publish-center.vue
内容以下:框架
<template> <router-view></router-view> </template> <script> export default { } </script>
作中间层,将最终的路由转接过去。这样就轻松的处理了这个问题。如下是个人路由配置项。iview
{ path: '/form', icon: 'settings', name: 'form', title: '系统配置', component: Main, children: [ { path: 'artical-publish', title: '用户配置', name: 'artical-publish', icon: 'compose', component: () => import('@/views/form/article-publish/artical-publish-center.vue'), children:[ { path: 'artical-publish-sub', title: '管理员', name: 'artical-publish-sub', icon: 'person', component: () => import('@/views/tables/exportable-table-JD.vue') }, { path: 'partInfo', title: '部门信息', name: 'partInfo', icon: 'person-stalker', component: () => import('@/views/form/work-flow/work-flow.vue') } ]}, { path: '', title: '工单配置', name: 'Worksheet', icon: 'wrench', component: () => import('@/views/form/work-flow/work-flow.vue') } ] },
出现了bug,请写bug demo,问题重现了?!?问题也就解决啦。^_^.net