el-table 三角形提示

本文介绍了如何在Vue项目中使用ElementUI的el-table组件,并结合slot-scope和el-tooltip功能,实现在表格单元格中显示可点击的动态内容以及定制样式。
摘要由CSDN通过智能技术生成

<template>
  <div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="ddd" label="日期2" width="150" />
      <el-table-column prop="ddd" label="日期2" width="150">
        <template slot-scope="scope">
          <el-tooltip effect="light" :content="scope.row.ddd" placement="top" popper-class="tipclass">
            <div v-html="scope.row.ddd" slot="content"></div>
            <div class="tooltips">{{ scope.row.ddd }}</div>
          </el-tooltip>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data () {
    return {
      tableData: [
        {
          ddd: '11111111111111111111111111111111111111111111111111'
        }
      ]
    }
  }
}
</script>

<style lang="less" >
.tipclass[x-placement^='top'] .popper__arrow {
  border-top-color: #fff !important;
  opacity: 1;
  position: relative;
  &::before {
    position: absolute;
    bottom: -9px;
    left: calc(50% - 10px);
    overflow: hidden;
    width: 8px;
    height: 8px;
    background: #fff;
    border-left: 1px solid #28b3f9;
    border-top: 1px solid #28b3f9;
    -webkit-transform: rotate(225deg);
    -moz-transform: rotate(225deg);
    -o-transform: rotate(225deg);
    transform: rotate(225deg);
    content: '';
  }
}

.tipclass {
  border: 1px solid #28b3f9 !important;
  color: red;
}
.tooltips {
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis; // ...展示
  display: -webkit-box; // 弹性伸缩盒盒子模型显示
  -webkit-line-clamp: 1; // 行数
  -webkit-box-orient: vertical; // 从上到下垂直排列子元素
}
</style>

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

学不会•

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值