permission.js 678 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * 权限、显示工具
  3. * @author LiQingSong
  4. */
  5. /**
  6. * 获取当前路由对应的顶部菜单path
  7. * @param route 当前路由
  8. * @returns String
  9. */
  10. export function getBelongTopMenuPath(route) {
  11. // const route = this.$route;
  12. const { meta, path } = route;
  13. if (meta.belongTopMenu) {
  14. return meta.belongTopMenu;
  15. }
  16. return '/' + path.split('/')[1];
  17. }
  18. /**
  19. * 获取当前路由选中的侧边栏菜单path
  20. * @param route 当前路由
  21. * @returns String
  22. */
  23. export function getActiveSidebarMenuPath(route) {
  24. // const route = this.$route;
  25. const { meta, path } = route;
  26. if (meta.activeMenu) {
  27. return meta.activeMenu;
  28. }
  29. return path;
  30. }