替换: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; /* 你想要的宽度 */
}

效果

相关推荐
陪小甜甜赏月18 小时前
ElementPlus 多个并列 Table 独立全选/取消全选 (适配嵌套表格业务)
前端·vue.js·elementui
大可-2 天前
CSDN博客-星火知识库教程
前端·javascript·vue.js·elementui·html
Liu.7746 天前
Vue3结合Element Plus封装点击查看大图的自定义指令
javascript·vue.js·elementui
跟着珅聪学java7 天前
Element UI 的 Tabs 标签页开发教程
javascript·vue.js·elementui
不是山谷.:.8 天前
Axios的【接口防抖 + 请求失败重试 + 弱网提示】三合一高阶版封装
前端·javascript·vue.js·笔记·elementui·typescript
镜宇秋霖丶13 天前
2026.5.12@霖宇博客制作中遇见的问题
前端·vue.js·elementui
镜宇秋霖丶16 天前
2026.5.10@霖宇博客制作中遇见的问题
前端·vue.js·elementui
莫生灬灬16 天前
ElementUI封装 共91个组件 支持易语言/火山/C#/Python
开发语言·c++·python·ui·elementui·c#
镜宇秋霖丶17 天前
2026.5.8@霖宇博客制作中遇见的问题
前端·vue.js·elementui
MXN_小南学前端18 天前
Vue + Element UI 分页器封装:比直接用 el-pagination 更省心的通用方案
javascript·vue.js·elementui