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

效果

相关推荐
chushiyunen2 天前
vue el-pagination实现分页
javascript·vue.js·elementui
一坨阿亮2 天前
使用e-tree开发树形穿梭框
javascript·vue.js·elementui
北极星日淘5 天前
可买免税店货物与安耐晒——特殊商品代购技术方案
javascript·vue.js·elementui
chushiyunen6 天前
vue插件element ui,element plus,ElMessage消息框,ref,动态绑定语法
vue.js·ui·elementui
流浪码农~7 天前
Element Plus DatePicker 动态设置每周起始日
前端·vue.js·elementui
依托偶尔宁9 天前
element-plus:el-table设置展开图标所在列的位置
前端·elementui
吠品11 天前
PyTorch 踩坑:libtorch_cpu.so 找不到 iJIT_NotifyEvent 符号
前端·vue.js·elementui
zhangyao94033019 天前
开发pc端时,表格的高度怎么设置才能铺满页面
前端·javascript·elementui
mengqudoh21 天前
elementui el-table 表头固定功能
javascript·vue.js·elementui
陪小甜甜赏月22 天前
ElementPlus 多个并列 Table 独立全选/取消全选 (适配嵌套表格业务)
前端·vue.js·elementui