是的 如图所示有那么一条数据 列表操作栏的按钮七八个 小屏笔记本啥数据项也别看了 就剩下个固定列大刺刺的占着整个页面
解决方法:
javascript
<el-table-column :width="tableToggle ? 600 : 300" label="操作栏" align="center" header-align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary">编辑</el-button>
<el-button size="mini" type="info">详情</el-button>
<div v-show="tableToggle" class="table-toggle">
<el-button size="mini" type="primary">下载</el-button>
<el-button size="mini" type="warning">上传</el-button>
<el-button size="mini" type="success">恢复</el-button>
<el-button size="mini" type="danger">删除</el-button>
</div>
<el-button size="mini" type="text" @click="tableToggle = !tableToggle">{{ tableToggle ? '收起' : '展开' }}
<i :class="tableToggle ? 'el-icon-caret-left' : 'el-icon-caret-right'"></i>
</el-button>
</template>
</el-table-column>
data里:
javascript
tableToggle: false,
css样式
javascript
<style lang="scss">
.table-toggle {
display: inline-block;
margin-left: 4px;
}
.toggle-btn span{
font-size: 12px;
}
</style>
实现效果:
这里的动态宽度600 300 需根据实际按钮数量修改