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

效果

相关推荐
Sterting7 天前
Form表单与校验
javascript·vue.js·elementui
Sterting8 天前
Element-Plus 入门与整体布局
前端·vue.js·elementui
yume_sibai9 天前
Element Plus 基础组件完全指南(12个核心组件)
前端·elementui
di24k24k15 天前
多个 el-form 共用同一 ref 导致表单校验部分失效
前端·javascript·vue.js·elementui
森林的尽头是阳光1 个月前
tree回显问题
javascript·vue.js·elementui
Bad_Shepherd1 个月前
vue-element-plus-admin添加自定义svg图标,并且图标选择组件可选自定义图标
vue.js·elementui·前端框架
不甘平凡的小鸟1 个月前
Element-UI记录
javascript·vue.js·ui·elementui
chushiyunen2 个月前
vue el-pagination实现分页
javascript·vue.js·elementui
一坨阿亮2 个月前
使用e-tree开发树形穿梭框
javascript·vue.js·elementui
北极星日淘2 个月前
可买免税店货物与安耐晒——特殊商品代购技术方案
javascript·vue.js·elementui