element导航菜单控制当前菜单样式

直接使用Element的导航菜单组件,参考官方文档:http://element-cn.eleme.io/#/zh-CN/component/menu

问题1:设置当前的导航样式,直接使用自带属性控制就可以。

<el-menu :default-active="$route.path"         :unique-opened="true"         class="el-menu-demo"         @select="handleSelect"         background-color="rgba(0,0,0,0)"         text-color="#fff"         active-text-color="#ffd04b">  <el-submenu index="1">    <template slot="title">      <!--<i class="el-icon-location"></i>-->      <img src="/static/images/icon/ic1.png"  class="ic-pic">      <span>运营中心</span>    </template>    <el-menu-item-group>      <el-submenu index="1-1">        <template slot="title">          <span>审核中心</span>        </template>        <el-menu-item-group>          <el-menu-item index="../index/auditHistory">            技术员审核          </el-menu-item>          <el-menu-item index="1-2">维保圆审核</el-menu-item>          <el-menu-item index="/index/propertyList">物业公司审核</el-menu-item>        </el-menu-item-group>      </el-submenu>      <el-menu-item index="/operation/businessList">业务列表</el-menu-item>    </el-menu-item-group>  </el-submenu>

<el-submenu index="2">    <template slot="title">      <!--<i class="el-icon-location"></i>-->      <img src="/static/images/icon/ic2.png"  class="ic-pic">      <span>电梯管理</span>    </template>    <el-menu-item-group>      <el-menu-item index="/ElevatorManagement">        统计看板      </el-menu-item>      <el-menu-item index="2-2">维保数据</el-menu-item>      <el-menu-item index="">警报数据</el-menu-item>      <el-menu-item index="/ElevatorManagement/ElevatorList">列表查看</el-menu-item>    </el-menu-item-group>  </el-submenu>  <el-submenu index="8">    <template slot="title">      <!--<i class="el-icon-location"></i>-->      <img src="/static/images/icon/ic1.png"  class="ic-pic">      <span>广告管理</span>    </template>    <el-menu-item-group>      <el-menu-item index="/advertisement/advertiserList">        广告列表      </el-menu-item>      <el-menu-item index="/advertisement/">广告设置</el-menu-item>    </el-menu-item-group>  </el-submenu>  <el-menu-item index="9">    <img src="/static/images/icon/ic8.png"  class="ic-pic">    <span slot="title">大数据中心</span>  </el-menu-item></el-menu>
@select="handleSelect"给菜单添加点击事件事件的定义:
handleSelect(key, keyPath) {  //key是index属性值,index可以直接设置路径。  this.$router.push({path:key})},这样就完成了,点击菜单跳转后自动保存当前菜单的状态。

问题2:只保持一个菜单展开unique-opened 是否只保持一个子菜单的展开

原文地址:https://www.cnblogs.com/xiaomg/p/10387098.html

时间: 2024-07-29 21:27:07

element导航菜单控制当前菜单样式的相关文章

NAV导航栏———下拉菜单

利用CSS实现导航栏菜单—下拉菜单. 首先给出HTML下拉菜单布局格式: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Stylin' with CSS - Figure 6.5 Drop-Down Menus</title> <link rel="stylesheet" type="text/css&

MUI组件三:列表、遮罩蒙版、数字输入框、侧滑导航和弹出菜单

1.list(列表) 列表是常用的UI控件,mui封装的列表组件比较简单,只需要在ul节点上添加.mui-table-view类.在li节点上添加.mui-table-view-cell类即可,如下为示例代码 <ul class="mui-table-view"> <li class="mui-table-view-cell">Item 1</li> <li class="mui-table-view-cell&q

RABC权限控制(二级菜单实现)

目前大部分系统由于用户体验,基本上菜单不会做的很深,以二级菜单为例,做了一个简单的权限控制实现,可精确到按钮级别(基于django),下面具体看看实现 1.表结构的设计 无论开发什么都需要先梳理清楚需求,然后再考虑表结构,这里先来说说大致的表结构组成,注意,我的权限控制是通过url做的,所以控制的核心就在于控制url 表字段介绍设计如下: 权限表 url # 权限 title #权限的标题,左侧展示,代表的功能(因为不可能展示url吧) menu # 所属的一级菜单,外键关联一级菜单 paren

以后台权限菜单控制为例,获取js路径后面参数值

<script type="text/javascript" src="../Public/js/common.js?menuids=1,2,3,4,5&ckids=4-5-6" /></script> 需要注意的是,此段js文件位置需要放在页面中所有js包含文件后面,目前暂未想到好的办法解决位置问题. //获取js后面参数 function getUrlArg(){ var url = $("script:last&quo

css导航栏下拉菜单代码【转自http://zxm.92.blog.163.com/blog/static/544600282010727112723874/】

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" c

自定义ActionBar标题与菜单中的文字样式

自定义标题文字样式 标题样式是ActionBar样式的一部分,所以要先定义ActionBar的样式 <style name="AppTheme" parent="AppBaseTheme"> <item name="android:actionBarStyle">@style/CustomActionBar</item> </style> 然后在ActionBar的样式中通过android:titl

VC++的菜单控制和自绘菜单

菜单控制为什么即使调用EnableMenuItem菜单项后,菜单项还处于禁止状态  需要将CFrameWnd:: m_bAutomenuEnable设置为FALSE,如果该数据成员为TRUE(缺省值),工作框将自动地禁止没有ON_UPDATE_COMMAND_UI或者ON_COMMAND的菜单项.//Disable MFC from automatically disabling menu items.m_bAuoMenuEnable=FALSE;//Now enable the menu it

1.鼠标点击换样式+2.下拉菜单缓慢显示/隐藏样式效果

1.鼠标点击换样式 <style type="text/css"> .aa{ width:90px; height:60px;text-align:center; vertical-align:middle; line-height:60px; margin-right:10px; font-size:19px; float:left; background-color:#06F} </style> <body> <div style=&quo

华丽导航CSS下拉菜单特效

华丽导航CSS下拉菜单特效,华丽导航,导航特效,CSS,下拉菜单,华丽特效. 代码地址:http://www.huiyi8.com/sc/26811.html 风景图片网:http://www.huiyi8.com/fengjing/