element ui 表格修改表头和每行的样式 去掉边框 每行的触发事件文字过长改变弹框宽度

<template>
  <div class="my_table">
    <el-table
      v-if="list"
      :data="list"
      style="width: 100%"
      :cell-style="{color:'#464646',backgroundColor:'transparent',fontSize:'13px',}"
      :row-style="{color:'#464646',backgroundColor:'transparent',fontSize:'13px',}"
      :header-cell-style="{color:'#454545',fontSize:'12px',backgroundColor:'transparent'}"
      @row-click="handle"
    >
      <el-table-column prop="index" width="80" label="排名"></el-table-column>
      <el-table-column v-if="level=='1'" width="150" show-overflow-tooltip prop="name" label="地区"></el-table-column>
      <el-table-column v-if="level=='2'" show-overflow-tooltip prop="allName" width="150" label="地区"></el-table-column>
      <el-table-column v-if="level=='3'" show-overflow-tooltip prop="allName2" label="地区"></el-table-column>
      <el-table-column show-overflow-tooltip prop="projects" label="非遗项目"></el-table-column>
      <el-table-column width="100" label="活力值">
        <template slot-scope="scope">
          <div style="display:flex;align-items: center;padding: 0 10px;">
            <div style="flex-grow: 1;">{{scope.row.heat}}</div>
            <div style="width:15px;margin-left:3px">
              <div v-if="scope.row.chainComparison==0" style="width:10px;height:3px;background:#ababab"></div>
              <img style="width:15px" v-if="scope.row.chainComparison==1" src="../../assets/image/bybcSecond/sheng.png" alt />
              <img v-if="scope.row.chainComparison==-1" style="width:15px" src="../../assets/image/bybcSecond/jiang.png" alt />
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import Vue from 'vue'
import ElementUI from 'element-ui'
Vue.use(ElementUI)
import 'element-ui/lib/theme-chalk/index.css'
export default {
  props: ['list', 'level'],
  data() {
    return {}
  },
  watch: {
    list(val, old) {
      // if(!this.level==1 ){
      val.forEach((element) => {
        element.allName = element.name + element.nameAs
        element.allName2 = element.name + element.nameAs + element.nameAs2
      })
      // }
    },
  },
  methods: {
    handle(row, event, column) {
      console.log(row, event, column)
      let url = this.$router.resolve({
        path: '/attendance/bybcsecond/detail',
        query: {
          id: row.rankingId,
          mom: row.mom,
          index: row.index,
          name: row.name,
          nameAs: row.nameAs,
          nameAs2: row.nameAs2,
          heat: row.heat,
          level: this.level,
        },
      })
      window.open(url.href, '_blank')
    },
  },
}
</script>
<style>
.el-tooltip__popper {
  max-width: 80%;
}
</style>
<style scoped>
.my_table >>> .el-table th.is-leaf,
.el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  /* 去除上边框 */
  border: none !important;
}
.my_table >>> .el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  border-bottom: none !important;
}
.my_table >>> .el-table,
.el-table__expanded-cell {
  /* background-color: transparent !important; */
  background: rgba(255, 255, 255, 0.89);
}
.my_table >>> .el-table::before {
  /* 去除下边框 */
  height: 0 !important;
}
.my_table >>> .el-table th.is-leaf {
  /* 去除上边框 */
  border: none !important;
}
.my_table >>> .el-table,
.el-table__expanded-cell {
  background-color: transparent;
}
.my_table >>> .el-table tr {
  background-color: transparent !important;
}
.my_table >>> .el-table--enable-row-transition .el-table__body td,
.el-table .cell {
  background-color: transparent;
}
.my_table >>> .el-table .el-table__cell {
  padding: 5px 0;
}
.el-tooltip__popper {
  max-width: 10px !important;
}
</style>

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值