var data = [ { path: '/home', name: '首页' }, { name: '系统组件', child: [ { name: '介绍', path: '/components' }, { name: '功能类', path: '/components', child: [ { path: '/components/permission', name: '详细鉴权' }, { path: '/components/pageTable', name: '表格分页' } ] }, { name: '辅助类', child: [ { path: '/components/pageNotes', name: '引用说明' } ] } ] }, { name: '完整示例', child: [ { path: '/example/table', name: '列表页面', permission: ['list/edit','list/query','list/add','list/delete'] } ] }, { path: '/i18n', name: '国际化' }, { path: '/theme', name: '主题切换' } ]
var partdata = [ { name:'list/edit' }, { name:'list/query' }, { path: '/i18n', name: '国际化' }, { path: '/theme', name: '主题切换' } ]
data是一张完整的路由表,然后需要根据partdata的数据来将完整的进行筛选,如果partdata中有的,这一项的所有父级都需要保留,如果这一项没有跟partdata无关,就需要删除,最终只保留具有partdata的路由表
相关分类