1.el-menu页面内控制激活的菜单$router.path :default-active
需求:页面内进行路由跳转,依然保持菜单项的选中状态
实现:将default-active设置为$route.path,el-menu-item的index设为要跳转的路由,设置el-submenu的index属性(1,2,3…)
<el-menu :default-active="$route.path" class="el-menu-vertical-demo" :collapse="isCollapse" router scroll > <el-submenu index="1"> <template slot="title"> <i class="el-icon-menu"></i> <span slot="title">导航一</span> </template> <el-menu-item index="/demo/index">选项1</el-menu-item> <el-menu-item index="/demo/group/index">选项2</el-menu-item> </el-submenu> </el-menu>
2.el-tree 树形的默认点击第一个node,并高亮
设置高亮显示的属性::highlight-current=“true”
设置tree的“ref”属性,可以进行操作对象
设置node-key,标识树节点的属性
<el-tree :data="treeData" :props="treeProps" node-key="id" :highlight-current="true" //是否高亮当前选中节点,默认值是 false。把它设置为true :filter-node-method="filterNode" ref="tree" @node-click="nodeClick"> </el-tree>```
this.$nextTick(() => { // tree 元素的ref value 绑定的node-key this.$refs.tree.setCurrentKey(treeList[0].departmentId); });
3.el-progress进度条修改底色(灰色部分)
<el-progress type="circle" :percentage="25"></el-progress> 1 .el-progress /deep/ path:first-child{ stroke: red; }
-------------------------------------------------------------
智一面|前端模拟面试练习提升题