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

效果

相关推荐
我的心巴1 天前
vue-print-nb 打印相关问题
前端·vue.js·elementui
Amy_cx2 天前
在表单输入框按回车页面刷新的问题
前端·elementui
xiaogg36782 天前
网站首页菜单顶部下拉上下布局以及可关闭标签页实现vue+elementui
javascript·vue.js·elementui
白云~️2 天前
table表格合并,循环渲染样式
javascript·vue.js·elementui
夏之小星星3 天前
解决el-select选择框右侧下拉箭头遮挡文字问题
前端·vue.js·elementui
xiaogg36783 天前
网站首页菜单两种布局vue+elementui顶部和左侧栏导航
前端·vue.js·elementui
Luffe船长3 天前
elementUI点击浏览table所选行数据查看文档
javascript·elementui·vue
入行IT两年半3 天前
element-plus 单选组件 el-radio,选不上,又没报错,直接复制官网也不行解决方案
前端·vue.js·elementui
IT瘾君4 天前
JavaWeb:前端工程化-ElementPlus
前端·elementui·node.js·vue
William Dawson4 天前
【从前端到后端导入excel文件实现批量导入-笔记模仿芋道源码的《系统管理-用户管理-导入-批量导入》】
java·前端·笔记·elementui·typescript·excel