0
点赞
收藏
分享

微信扫一扫

el-table自定义表头


实现效果

el-table自定义表头_vue


el-table自定义表头_vue_02

<!--
 * @Descripttion: el-table自定义表头
 * @version: 
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2020-05-14 09:08:01
 * @LastEditors: zhangfan
 * @LastEditTime: 2020-06-29 18:53:17
--> 
<template>
  <div class="topCon">
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="date" label="日期" width="180"></el-table-column>
      <el-table-column prop="name" label="姓名" width="180"></el-table-column>
      <el-table-column prop="address" label="地址"></el-table-column>
      <el-table-column prop="tel" label="联系人电话">
        <template v-slot:header>
          <span>联系人电话</span>
          <span
            class="icon iconfont viewIcon"
            @click="isShowTel = !isShowTel"
            :class="isShowTel==true?'iconxianshi':'iconyincang'"
          ></span>
        </template>
        <template v-slot:default="scope">
          <p v-if="scope.row.tel && !isShowTel">{{scope.row.tel | deseHandler(4,4,'*') || ""}}</p>
          <p v-if="scope.row.tel && isShowTel">{{scope.row.tel}}</p>
          <p v-if="!scope.row.tel">未填写</p>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "enterpriseDetail",
  data() {
    return {
      isShowTel: false,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
          tel: "15327755860"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
          tel: "15327755861"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
          tel: "15327755862"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
          tel: "15327755863"
        }
      ]
    };
  },
  computed: {},
  methods: {}
};
</script>

<style  scoped lang="less">
.viewIcon {
  cursor: pointer;
}
</style>


举报

相关推荐

0 条评论