Menu.js 745 B

12345678910111213141516171819202122232425262728
  1. export default class Menu {
  2. constructor(Dcat) {
  3. this.bindClick();
  4. }
  5. // 菜单点击选中效果
  6. bindClick() {
  7. // 滚动条优化
  8. new PerfectScrollbar('.main-sidebar .sidebar');
  9. let $content = $('.main-menu-content'),
  10. $items = $content.find('li'),
  11. $hasSubItems = $content.find('li.has-treeview');
  12. $items.find('a').click(function () {
  13. let href = $(this).attr('href');
  14. if (! href || href === '#') {
  15. return;
  16. }
  17. $items.find('.nav-link').removeClass('active');
  18. // $hasSubItems.removeClass('menu-open');
  19. $(this).addClass('active')
  20. });
  21. }
  22. }