当前位置: 首页 > article >正文

Vue2:el-table 最后一列的操作按钮不换行,按钮过多时展示【更多】

表格中最后一列为操作按钮。有时候按钮比较多,就会换行展示,将行高撑大,很难看。所以需要控制按钮都显示在同一行,如果太多显示不下,出现一个下拉列表。

1、flex 布局来控制按钮的显示

设置 display: flex 来将按钮放在同一行,设置 white-space: nowrap 来禁止换行。

<el-table-column label="操作">
  <template slot-scope="scope">
    <div style="display: flex; white-space: nowrap;">
      <!-- 这里可以放置操作按钮的代码 -->
    </div>
  </template>
</el-table-column>
 

2、将其它按钮放在el-dropdown 组件中

click触发

<el-table-column label="操作">
  <template slot-scope="scope">
    <div style="display: flex; white-space: nowrap;">
      <el-button>按钮1</el-button>
      <el-button>按钮2</el-button>
      <el-button>按钮3</el-button>
      <el-dropdown trigger="click" style="margin-left: 10px">
        <el-button slot="default" type="text">更多</el-button>
        <el-dropdown-menu slot="default">
          <el-dropdown-item>按钮4</el-dropdown-item>
          <el-dropdown-item>按钮5</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </template>
</el-table-column>
 


http://www.kler.cn/a/502938.html

相关文章:

  • 掌握 React 关键:理解 super () 和 super (props) 的不同应用
  • (PVG)Periodic Vibration Gaussian:自动驾驶过程中的三维重建 论文解读
  • 3.Qt Quick-QML地图引擎之v4.3版本(新增动态轨迹线/海图/天地图街道/天地图卫星)
  • java fastjson2 解析JSON用法解析
  • [3D] 3D雷达天眼监控系统:打造智能城市的安全防线
  • 多模态论文笔记——BLIP2
  • 大语言模型的稀疏性:提升效率与性能的新方向
  • 《AI赋能鸿蒙Next,开启智能关卡设计新时代》
  • occ的开发框架
  • vue3项目大屏适配方案(scale)及vue-tv-focusable库使用
  • 基于访问表的安全防范策略
  • 【samba】主机名访问ubuntu的samba文件夹
  • 消息中间件面试
  • Ubuntu如何安装ESP32-idf
  • UML系列之Rational Rose笔记七:状态图
  • 50_Lua垃圾回收
  • 使用 Debug 类的 Assert 方法查找 C# 中的错误
  • 施耐德M241与MR30-FBS-MT 在Machine Expert V2.0的组态过程
  • opencv对算法用C++实践
  • Unity Webgl + WebAPI 之 SqlSugar根据Mysql表反向生成实体类