Javascript AdminLTE子菜单展开然后折叠

Javascript AdminLTE子菜单展开然后折叠,javascript,jquery,submenu,adminlte,Javascript,Jquery,Submenu,Adminlte,我在一个由其他人启动的项目中使用AdminLTE 我在添加子菜单时看到的行为是,它会立即展开然后折叠 我试过使用完整的 如果我在本地打开模板中的index.html,它就可以正常工作 我认为这个项目可能遗漏了一些东西,但无法找出什么。。。尝试加载所有js,我在控制台中没有看到任何错误 任何帮助都将不胜感激。侧边栏行为不受index.html文件控制,而是由adminlte的/dist/js文件夹中的app.js文件控制。 项目中必须包含此文件(以及其他文件) 我的建议是,首先看看你的app.js

我在一个由其他人启动的项目中使用AdminLTE

我在添加子菜单时看到的行为是,它会立即展开然后折叠

我试过使用完整的

如果我在本地打开模板中的index.html,它就可以正常工作

我认为这个项目可能遗漏了一些东西,但无法找出什么。。。尝试加载所有js,我在控制台中没有看到任何错误


任何帮助都将不胜感激。

侧边栏行为不受index.html文件控制,而是由adminlte的/dist/js文件夹中的app.js文件控制。 项目中必须包含此文件(以及其他文件)

我的建议是,首先看看你的app.js文件是否没有被之前从事hte项目的人修改过,或者你是否可以在其他地方使用一些脚本来覆盖默认的侧栏行为

控制左侧边栏的原始代码从app.js文件(adminlte v2.3.6)的第380行开始,如下所示:

$.AdminLTE.tree = function(menu) {
  var _this = this;
  var animationSpeed = $.AdminLTE.options.animationSpeed;
  $(document).off('click', menu + ' li a')
      .on('click', menu + ' li a', function(e) {
          //Get the clicked link and the next element
          var $this = $(this);
          var checkElement = $this.next();

          //Check if the next element is a menu and is visible
          if ((checkElement.is('.treeview-menu')) && (checkElement.is(':visible')) && (!$('body').hasClass('sidebar-collapse'))) {
              //Close the menu
              checkElement.slideUp(animationSpeed, function() {
                  checkElement.removeClass('menu-open');
                  //Fix the layout in case the sidebar stretches over the height of the window
                  //_this.layout.fix();
              });
              checkElement.parent("li").removeClass("active");
          }
          //If the menu is not visible
          else if ((checkElement.is('.treeview-menu')) && (!checkElement.is(':visible'))) {
              //Get the parent menu
              var parent = $this.parents('ul').first();
              //Close all open menus within the parent
              var ul = parent.find('ul:visible').slideUp(animationSpeed);
              //Remove the menu-open class from the parent
              ul.removeClass('menu-open');
              //Get the parent li
              var parent_li = $this.parent("li");

              //Open the target menu and add the menu-open class
              checkElement.slideDown(animationSpeed, function() {
                  //Add the class active to the parent li
                  checkElement.addClass('menu-open');
                  parent.find('li.active').removeClass('active');
                  parent_li.addClass('active');
                  //Fix the layout in case the sidebar stretches over the height of the window
                  _this.layout.fix();
              });
          }
          //if this isn't a link, prevent the page from being redirected
          if (checkElement.is('.treeview-menu')) {
              e.preventDefault();
          }
      });};

你知道答案了吗,我也遇到了同样的问题???不知道,我不得不用别的东西