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

效果

相关推荐
Polaris_YJH2 天前
使用Vue3+Vite+Pinia+elementUI搭建初级企业级项目
前端·javascript·elementui·vue
极致♀雨3 天前
vue2+elementUI table表格勾选行冻结/置顶
前端·javascript·vue.js·elementui
无法长大3 天前
如何判断项目需不需要用、能不能用Tailwind CSS
前端·css·vue.js·elementui·vue3·tailwind css
Aotman_4 天前
Vue el-table 表尾合计行
前端·javascript·vue.js·elementui·前端框架·ecmascript
Hexene...5 天前
【前端Vue】出现elementui的index.css引入报错如何解决?
前端·javascript·vue.js·elementui
小小弯_Shelby8 天前
el-table固定列显示错位问题处理
vue.js·elementui
小小弯_Shelby10 天前
el-form表单简洁有效地解决新增与查看详情共用一个页面问题,控制el-form的disabled设置和修改样式
前端·vue.js·elementui
Mr Xu_11 天前
前端实战:基于Element Plus的CustomTable表格组件封装与应用
前端·javascript·vue.js·elementui
harrain11 天前
vue3怎么扩展第三方依赖库内部逻辑(拿element plus举例)
前端·javascript·vue.js·elementui
Mr Xu_12 天前
深入分析Element UI Tree组件在本地与生产环境样式差异问题
css·ui·elementui