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;
}
相关推荐
新中地GIS开发老师4 小时前
零基础WebGIS开发入门 | GeoJSON数据持久化
前端·javascript·gis·webgis·三维gis开发
blns_yxl4 小时前
正则驱动实时表单验证(HTML+CSS+JS+正则)
javascript·css·html
sunywz4 小时前
【c#】 Web Deploy一键发布,IIS部署全流程
开发语言·前端·c#
宁&沉沦5 小时前
Chrome 扩展 Manifest 字段版本支持一览(全量)
前端·后端·编辑器
乖孩子5 小时前
Service Worker + IndexedDB 实践
前端
浮生望5 小时前
BFF架构实战:用Express+SSE为Vue3搭建安全的流式对话中间层
前端
Quz5 小时前
QML 与 JavaScript 交互方式:内联函数、外部文件、信号槽与工作线程
javascript·qt
先吃饱再说5 小时前
React 组件通信:从 Props 单向传递到自定义事件
前端·react.js·前端框架
swipe5 小时前
05|(前端转后全栈)不手写一堆 SQL,后端怎么操作数据库?MyBatis-Plus 入门
前端·后端·全栈
Allshadow5 小时前
Nest.js - 连接数据库
javascript·nestjs