zoukankan      html  css  js  c++  java
  • Superset导航栏高亮问题处理

    在superset => templates => appbuilder 文件夹下找到 navbar.html 如果没有可对应新建,navbar.html内容如下

    {% set menu = appbuilder.menu %}
    {% set languages = appbuilder.languages %}
    {% set WARNING_MSG = appbuilder.app.config.get('WARNING_MSG') %}
    {% set app_icon_width = appbuilder.app.config.get('APP_ICON_WIDTH', 126) %}
    {% set logo_target_path = appbuilder.app.config.get('LOGO_TARGET_PATH') or '/profile/{}/'.format(current_user.username) %}
    
    <div class="navbar navbar-static-top {{ menu.extra_classes }}" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="{{ '/superset' + logo_target_path if current_user.username is defined else '#' }}">
                    <img
                            width="{{ app_icon_width }}"
                            src="{{ appbuilder.app_icon }}"
                            alt="{{ appbuilder.app_name }}"
                    />
                </a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    {% if WARNING_MSG %}
                        <li class="alert alert-danger">
                            {{ WARNING_MSG | safe }}
                        </li>
                    {% endif %}
                    {% include 'appbuilder/navbar_menu.html' %}
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% include 'appbuilder/navbar_right.html' %}
                </ul>
            </div>
        </div>
    </div>
    
    <script>
    // Highlight the navbar menu
    const menus = document.querySelectorAll('.nav.navbar-nav li')
    for (const menu of menus.values()) {
      const classes = menu.getAttribute('class')
      const as = menu.querySelectorAll('a')
      for (const a of as.values()) {
        const href = a.getAttribute('href')
        let path = location.pathname
        if (path.indexOf(href) > -1) {
          menu.setAttribute('class', `${classes} active`)
        } else {
          menu.setAttribute('class', `${classes}`)
        }
      }
    }
    </script>

    存在的问题:带有下拉菜单的不能高亮

  • 相关阅读:
    UML图示与代码对照
    http连接
    http 连接失败重连机制
    httpclient失败重连机制
    mybatis <!-- useGeneratedKeys="true"把新增加的主键赋值到自己定义的keyProperty(id)中 -->
    30分钟学会如何使用Shiro(转)
    散列算法与加密算法
    存储过程的优缺点
    mybatis批量更新两种方式:1.修改值全部一样 2.修改每条记录值不一样
    xml解析工具mashaller javaee自带解析类
  • 原文地址:https://www.cnblogs.com/Man-Dream-Necessary/p/13046482.html
Copyright © 2011-2022 走看看