当前位置:网站首页>el-table中el-table-column下的操作切换class样式
el-table中el-table-column下的操作切换class样式
2022-07-30 12:51:00 【周家大小姐.】
需求:用操作按钮太多;设计这边想如果按钮大于3个就把它放在更多中;如果点击更多;就向左出现;再点击就隐藏,如果当前row为展开又点其它row的更多 ;就把这个展开的关闭箭头恢复成向左显示

代码:
el-table结合el-popover弹出框
html:
<el-popover
placement="left-end"
width="200"
trigger="click"
popper-class="xk-flex-popover"
:offset="-15"
:visible-arrow="false"
@show="handleShow(scope.$index)"
@hide="handleHide(scope.$index)"
>
<!-- <transition name="slide-fade"> v-if="scope.$index == isRotateIndex"-->
<div>
<el-button
type="text"
size="mini"
@click="handleEditReport(scope.row)"
>报告日志</el-button
>
<el-button
type="text"
size="mini"
@click="handleEditReport(scope.row)"
>检测详情</el-button
>
<el-button
type="text"
size="mini"
@click="handleEditReport(scope.row)"
>发起复测</el-button
>
</div>
<!-- </transition> -->
<el-button slot="reference" type="text">
<i
:class="[
'el-icon-arrow-left',
isRotateIndex === scope.$index && isRotateShow
? 'xk-rotate-170'
: 'xk-rotate-0'
]"
></i>
更多</el-button
>
</el-popover>css:
.xk-rotate-170 {
transform: rotate(-180deg);
transition: all .3s;
}
.xk-rotate-0 {
// animation: rotate0 0.3s;
transform: rotate(0deg);
transition: all .3s;
}js:
data () {
return {
isRotateShow: false,
isRotateIndex: null,
preRotateIndex: null
}
},
methods: {
// 处理table中操作栏下的更多旋转方法
// 更多关闭
handleHide (i) {
if (this.preRotateIndex !== i) {
// 如果上一个index和当前index不相等就让上一个关闭当前这个展开
this.isRotateShow = true
this.isRotateIndex = this.preRotateIndex
return
}
// 如果上一个和当前index不相等就还原
this.isRotateIndex = null
this.isRotateShow = false
},
// 更多展开
handleShow (i) {
this.isRotateShow = true
this.isRotateIndex = i
this.preRotateIndex = i
}
}
效果如下:

边栏推荐
猜你喜欢
随机推荐
Execution order of select, from, join, on where groupby, etc. in MySQL
C语言学习练习题:汉诺塔(函数与递归)
int a=8,a=a++,a? int b=8,b=b+1,b?
基于DoS攻击能量分级的ICPS综合安全控制与通信协同设计
一文读懂Elephant Swap,为何为ePLATO带来如此高的溢价?
漫谈金丝雀部署(Canary Deployment)
R语言使用方差分析ANOVA比较回归模型的差异、anova函数比较两个模型并报告它们是否存在显著差异(两个模型的数据相同,一个模型使用的预测特征包含另外一个模型的特征)
监控界的最强王者,没有之一!
Yilian: Activating the Value Potential of Data Elements and Unleashing the Innovation Dividend of SAS SSD
RTSP/Onvif协议视频平台EasyNVR服务一键升级功能的使用教程
dolphinscheduler简单任务定义及复杂的跨节点传参
句柄与指针的简单理解
ES6 Set与Map是什么,如何使用
力扣——15. 三数之和
What are the hard-core upgrades and applications that cannot be missed in Greenplum 6.0?
R语言筛选时间序列数据的子集(subset time series data)、使用window函数筛选连续日期时间范围内的数据(start参数和end参数分别指定起始和结束时间)
干货分享:小技巧大用处之Bean管理类工厂多种实现方式
Xms Xmx PermSize MaxPermSize 区别
基于柔性人机接口的人机协调运动控制方法
Dry Goods Sharing: Various Implementation Methods of Bean Management Factory with Great Use of Small Skills









