替换:show-overflow-tooltip=“true“ ,使用插槽tooltip,达到内容可复制

原生的show-overflow-tooltip="true" 不能满足条件,使用插槽自定义编辑;

旧code

javascript 复制代码
<el-table-column prop="reason" label="原因" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="params" label="参数" align="center" :show-overflow-tooltip="true" />

新code

javascript 复制代码
<el-table-column prop="reason" label="原因" align="center">
  <template slot-scope="scope">
    <el-tooltip class="item" effect="dark" placement="top-start">
      <div slot="content">{{ scope.row.reason }}</div>
      <div style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
        {{ scope.row.reason }}
      </div>
    </el-tooltip>
  </template>
</el-table-column>
<el-table-column prop="params" label="参数" align="center">
  <template slot-scope="scope">
    <el-tooltip class="item" effect="dark" placement="top-start">
      <div slot="content">{{ scope.row.params }}</div>
      <div style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
        {{ scope.row.params }}
      </div>
    </el-tooltip>
  </template>
</el-table-column>

新css样式

css 复制代码
.el-tooltip__popper {
  max-width: 500px !important; /* 你想要的宽度 */
}

效果

相关推荐
我是Superman丶13 小时前
【前端UI框架】VUE ElementUI 离线文档 可不联网打开
前端·vue.js·elementui
乐~~~16 小时前
el-tabs 自适应高度
elementui·scss
J总裁的小芒果2 天前
vue3-print打印eletable某一行的数据
javascript·vue.js·elementui
机器人迈克猫2 天前
Django_Vue3_ElementUI_Release_004_使用nginx部署
nginx·elementui·django
代码搬运媛2 天前
el-table 如何实现行列转置?
javascript·vue.js·elementui
繁依Fanyi3 天前
使用 Spring Boot + Vue + ElementUI 构建简易评分系统
java·开发语言·vue.js·人工智能·spring boot·算法·elementui
尸僵打怪兽3 天前
后台数据管理系统 - 项目架构设计-Vue3+axios+Element-plus(0917)
开发语言·javascript·vue.js·elementui
快乐小土豆~~4 天前
el-input设置后缀显示单位并阻止滚轮微调
前端·vue.js·elementui
加勒比海涛4 天前
ElementUI 快速入门:使用 Vue 脚手架搭建项目
前端·vue.js·elementui