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

效果

相关推荐
进阶的小木桩3 天前
Vue 3 + Elementui + TypeScript 实现左侧菜单定位右侧内容
vue.js·elementui·typescript
北辰浮光6 天前
[Element-plus]动态设置组件的语言
javascript·vue.js·elementui
胡斌附体6 天前
elementui cascader 远程加载请求使用 选择单项等
前端·javascript·elementui·cascader·可独立选中单节点
小离a_a8 天前
el-tree方法的整理
前端·vue.js·elementui
code_txy9 天前
element plus table 表格操作列根据按钮数量自适应宽度
elementui
阿奇__9 天前
深度修改elementUI样式思路
前端·vue.js·elementui
什么什么什么?12 天前
el-table高度自适应vue页面指令
前端·javascript·elementui
海天胜景12 天前
vue3 el-table 去除小数 并使用千分号
javascript·vue.js·elementui
肖恩想要年薪百万13 天前
ElementUI常用的组件展示
前端·javascript·elementui
像素之间16 天前
elementui中rules的validator 用法
前端·javascript·elementui