当前位置:网站首页>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
}
}
效果如下:

边栏推荐
- R语言时间序列数据算术运算:使用log函数将时间序列数据的数值对数化(平方、开平方、指数化等函数类似使用)
- 基于柔性人机接口的人机协调运动控制方法
- 监控界的最强王者,没有之一!
- 使用百度EasyDL实现明厨亮灶厨师帽识别
- 来n遍剑指--04. 二维数组中的查找
- 【23考研】408代码题参考模板——顺序表
- datax开启hana支持以及dolphinscheduler开启datax任务
- Lake storehouse which electricity (2) of the project: project using technology and version and the environment
- IDEA 重复代码快速重构(抽取重复代码快捷键)
- ES6 Set与Map是什么,如何使用
猜你喜欢
随机推荐
最基础01/完全背包
浅析TSINGSEE智能视频分析网关的AI识别技术及应用场景
并行化快速排序设想
基于卷积神经网络与双向长短时融合的锂离子电池剩余使用寿命预测
Markdown 1 - 图文音视频等
什么是私有云?您应该知道的 6 个优势
How to migrate the device data connected by RTSP of EasyCVR platform to EasyNVR?
MySQL【多表查询】
第42讲:Scala中泛型类、泛型函数、泛型在Spark中的广泛应用
DOM常用方法以及项目
Go 事,Gopher 要学的数字类型,变量,常量,运算符 ,第2篇
展厅全息投影所具备的三大应用特点
[PostgreSQL] - 存储结构及缓存shared_buffers
datax enables hana support and dolphinscheduler enables datax tasks
dolphinscheduler添加hana支持
Mysql 批量插入事务唯一键重复处理
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化箱图、width参数自定义箱图中箱体的宽度
DeFi 巨头进军 NFT 领域 用户怎么看?
Add the device library after Vivado installation
Why is Prometheus a monitoring artifact sufficient to replace Zabbix?









