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

效果

相关推荐
BillKu9 小时前
el-input 中 select 方法使用报错:属性“select”在类型“HTMLElement”上不存在
前端·javascript·vue.js·elementui
介si啥呀~11 小时前
vue2 el-element中el-select选中值,数据已经改变但选择框中不显示值,需要其他输入框输入值才显示这个选择框才会显示刚才选中的值
javascript·vue.js·elementui
牧码岛1 天前
Web前端之Vue+Element实现表格动态不同列合并多行、localeCompare、forEach、table、push、sort、Map
前端·javascript·elementui·vue·web·web前端
DCTANT1 天前
【原创】vue-element-admin-plus完成确认密码功能,并实时获取Form中表单字段中的值
前端·javascript·vue.js·elementui·typescript
程序员易晶1 天前
vue2添加背景水印-手动实现(无组件模式)
javascript·vue.js·elementui
今天吃了嘛o2 天前
vue中根据html动态渲染内容2.0
vue.js·elementui·html
意桉2 天前
Element Plus 去掉表格外边框
前端·vue.js·elementui·element plus
超爱吃香菜的菜鸟2 天前
求教:vue中的find()函数的用法&this.$set
前端·javascript·vue.js·elementui
tryCbest3 天前
Vue2-实现elementUI的select全选功能
前端·javascript·elementui
小破孩呦3 天前
动态列表的数据渲染、新增、编辑等功能开发及数据处理
前端·javascript·elementui