baseMenu.ts 884 B

1234567891011121314151617181920212223242526272829303132
  1. import {ItemMenu} from "~/types/types";
  2. class BaseMenu{
  3. private $config:any;
  4. constructor($config:any) {
  5. this.$config = $config;
  6. }
  7. /**
  8. * Construit un ItemMenu
  9. * @param {string} icon
  10. * @param {string} title titre qui sera traduit
  11. * @param {string} link lien
  12. * @param {boolean} isOldLink est-ce un lien renvoyant vers l'ancien admin ?
  13. * @param {Array<ItemMenu>} children Tableau d'ItemMenu représentant les sous menu du menu principal
  14. * @return {ItemMenu}
  15. */
  16. constructMenu(icon: string, title: string, link?: string, isOldLink?: boolean, children?: Array<ItemMenu>): ItemMenu{
  17. return children ? {
  18. icon: icon,
  19. title: title,
  20. children: children,
  21. } : {
  22. icon: icon,
  23. title: title,
  24. to: `${isOldLink ? this.$config.baseURL_adminLegacy : ''}${link}`,
  25. old: isOldLink,
  26. }
  27. }
  28. }
  29. export default BaseMenu;