src/store/modules/permission.js
/**
 * Filter asynchronous routing tables by recursion
 * @param routes asyncRoutes
 * @param roles
 * @param rights
 */
Filter asynchronous routing tables by recursion
@param routes asyncRoutes
@param roles
@param rights
Filter asynchronous routing tables by recursion @param routes asyncRoutes @param roles @param rights
function filterAsyncRoutes(routes, roles, rights) {
  const res = []
  routes.forEach(route => {
    const tmp = { ...route }
    if (hasPermission(roles, rights, tmp)) {
      if (tmp.children) {
        tmp.children = filterAsyncRoutes(tmp.children, roles, rights)
      }
      res.push(tmp)
    }
  })
  return res
}
function filterAsyncRoutes ( routes , roles , rights ) { const res = [ ] routes . forEach ( route => { const tmp = { ... route } if ( hasPermission ( roles , rights , tmp ) ) { if ( tmp . children ) { tmp . children = filterAsyncRoutes ( tmp . children , roles , rights ) } res . push ( tmp ) } } ) return res }
Filter asynchronous routing tables by recursion
 @param routes asyncRoutes
 @param roles
 @param rights
Filter asynchronous routing tables by recursion @param routes asyncRoutes @param roles @param rights