赞
踩
问题说明:tree树状图展开的时候问题太长被覆盖
办法解决:上代码
html:
<el-tree :data="typeList" :props="{ children: 'children',label: 'value'}" accordion @node-click="handleNodeClick"> <div slot-scope="{ node }" class="tree-node"> <el-tooltip :content="node.label" :disabled="isShowTooltip" :open-delay="300" placement="top" effect="dark" > <span class="over-ellipsis" @mouseover="mouseOver($event)"> {{ node.label }} </span> </el-tooltip> </div> </el-tree>
methods:鼠标经过事件
mouseOver(event) {
console.log(event);
//在data里边记得要定义一个isShowTooltip默认为false
this.isShowTooltip =
event.currentTarget.scrollWidth <= event.currentTarget.clientWidth;
// console.log("222");
},
css部分
.tree-node { flex: 1; display: flex; align-items: center; justify-content: space-between; font-size: 14px; /* padding-right: 8px; */ } .over-ellipsis { display: block; width: 140PX; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; -webkit-line-clamp: 1; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。