Laravel 背包下拉菜单问题

Laravel backpack dropdown menu issue

我创建了一个带有一些链接的下拉菜单。它在桌面上工作正常,但在移动设备上有一个奇怪的问题。当我展开菜单时,它不会下推其下方的其他菜单。但是,如果我重新加载页面一次!换句话说,当我打开一个页面时,它不会向下推,而当我刷新它时,它会向下推。如果我再次尝试刷新它,那么问题又回来了,依此类推。 查看照片以了解具体问题:

Issue is shown

No issue

这里是相关的(据我所知)代码:

<!-- This file is used to store sidebar items, starting with Backpack\Base 0.9.0 -->
<li><a href="{{ backpack_url('dashboard') }}"><i class="fa fa-dashboard"></i><span>{{ trans('backpack::base.dashboard') }}</span></a></li>
@if (Auth::user()->admin) 
<!-- @if(isset($company) && !Auth::user()->admin)
<li class="treeview active menu-open">
@else -->
<li class="treeview">
<!-- @endif -->
    <a href="#">
    <i class="fa fa-building"></i>
    <span>Välj ett företag</span>
    <span class="pull-right-container">
        <i class="fa fa-angle-left pull-right"></i>
    </span>
    </a>   
        <ul class="treeview-menu">    
        @foreach($allCompanies as $singleCompany)
  <!--       @if(isset($company) && $singleCompany->id == $company->id)
            <li class="active">
        @else -->
            <li>
       <!--  @endif -->
                <a href="/company/{{ $singleCompany->id }}">{{ $singleCompany->name }}</a>
            </li>
        @endforeach
        </ul>    
</li>
@endif
<!-- @if (Request::is('cp/*'))
<li class="treeview active">
@else -->
<li class="treeview">
<!-- @endif -->
    <a href="#">
    <i class="fa fa-building"></i>
    <span>Kontrollpanelen</span>
    <span class="pull-right-container">
        <i class="fa fa-angle-left pull-right"></i>
    </span>
    </a>
    <ul class="treeview-menu">
        @if (Auth::user()->admin) 
         <!--    @if (Request::is('cp/addcompanyview'))           
            <li class="active">
            @else -->
            <li>
            <!-- @endif  -->               
            <a class="btn btn-primary btn-block" href="/cp/addcompanyview" role="button">
                Lägg till företag
                </a>
            </li>
     <!--        @if (Request::is('cp/adduserview'))           
            <li class="active">
            @else -->
            <li>
           <!--  @endif  --> 
            <a class="btn btn-primary btn-block" href="/cp/adduserview" role="button">
                Lägg till handläggare
            </a></li>
        <!--     @if (Request::is('cp/user/*') || Request::is('cp/user'))           
            <li class="active">
            @else -->
            <li>
           <!--  @endif  --> 
            <a class="btn btn-primary btn-block" href="/cp/user" role="button">
                Hantera handläggare
            </a></li>
    <!--         @if (Request::is('cp/managecompaniesview'))           
            <li class="active">
            @else -->
            <li>
            <!-- @endif   -->
            <a class="btn btn-primary btn-block" href="/cp/managecompaniesview" role="button">
                Hantera företag
            </a></li>        
        <!-- @endif -->
  <!--       @if (Request::is('cp/manageclientsview'))           
        <li class="active">
        @else  -->
        <li>
     <!--    @endif  --> 
        <a class="btn btn-primary btn-block" href="/cp/manageclientsview" role="button">
              Hantera kunder
        </a></li>   
    </ul>
</li>
@if (Auth::user()->admin)    
<li><a href="{{ url(config('backpack.base.route_prefix', '').'/backup') }}"><i class="fa fa-hdd-o"></i> <span>Backups</span></a></li>
@endif

问题确实与 JS 相关,它是背包的添加,而不是 AdminLTE。

此代码导致会话变量被保存 "getting forgotten" 在刷新时导致主题出现问题:

/* Store sidebar state */
/*         $('.sidebar-toggle').click(function(event) {
          event.preventDefault();
          if (Boolean(sessionStorage.getItem('sidebar-toggle-collapsed'))) {
            sessionStorage.setItem('sidebar-toggle-collapsed', '');
          } else {
            sessionStorage.setItem('sidebar-toggle-collapsed', '1');
          }
        });

我注释掉了,问题就解决了

PS:此代码位于背包默认主题的layout.blade.php。