elementui table超出两行显示...鼠标已入tip显示

elementui el-table超出两行显示...鼠标已入tip显示

方式一
html 复制代码
<el-table-column 
        label="描述"
        prop="note"
        class-name="myNoteBox"
      >
        <template slot-scope="scope">
          <!-- tips悬浮提示 -->
           <el-tooltip placement="top">
            <div slot="content" class="table-tip-box" >
              {{ scope.row.text}}
            </div>
            <div class="table-ellipsis">{{ scope.row.text}}</div>
          </el-tooltip>  
   </template>
 </el-table-column>
css 复制代码
.table-ellipsis {
  word-break: break-all;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
}
// 提示框的最大宽度
.table-tip-box {
  max-width: 500px;
}
方式二
javascript 复制代码
<el-table-column
        v-if="false"
        label="描述"
        prop="note"
        class-name="myNoteBox"
      >
        <template slot-scope="scope"> 
       <el-popover
            placement="top-start" 
            width="200"
            trigger="hover"
            :content="scope.row.text"
          >
            <div slot="reference" class="twoLineCls">
              {{ scope.row.text}}
            </div>
          </el-popover> 
        </template>
      </el-table-column>
css 复制代码
.twoLineCls {
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
相关推荐
MediaTea7 分钟前
Python:模块 __dict__ 详解
开发语言·前端·数据库·python
字节跳动开源34 分钟前
Midscene v1.0 发布 - 视觉驱动,UI 自动化体验跃迁
前端·人工智能·客户端
光影少年43 分钟前
三维前端需要会哪些东西
前端·webgl
王林不想说话1 小时前
React自定义Hooks
前端·react.js·typescript
颜酱1 小时前
滑动窗口详解:原理+分类+场景+模板+例题(视频贼清晰)
javascript
heyCHEEMS1 小时前
Uni-app 性能天坑:为什么 v-if 删不掉 DOM 节点
前端
马致良1 小时前
三年前写的一个代码工具,至今已被 AI Coding 完全取代。
前端·ai编程
橙某人1 小时前
LogicFlow 交互新体验:让锚点"活"起来,鼠标跟随动效实战!🧲
前端·javascript·vue.js
借个火er2 小时前
依赖注入系统
前端
借个火er2 小时前
项目介绍与环境搭建
前端