element表格封装 支持多级表格

businessTable组件

  <el-table ref="vtable" :data="tableData"
                 :reserve-selection="true" 
                border 
                highlight-current-row
                row-key="id"
                @selection-change="selectTableData">
          <!-- 无数据时显示  -->
          <template slot="empty">
              <img v-if="!!emptyText" alt="" src="@/assets/empty.svg">
              <div v-if="!!emptyText" class="table_empty_tip">
                  <p>未查询到相关数据</p>
                  <p>您还没有尝试添加过任何内容.</p>
              </div>
          </template>
          <el-table-column :reserve-selection="true" type="selection"
                           width="50"></el-table-column>
          <!-- 表格列 -->
          <business-table-item :table-column-list="tableColumn"></business-table-item>
      </el-table>

businessTableItem组件

      <el-table-column v-for="(item,index) in tableColumnList" :key="index"
                         :align="item.align" :label="item.name" :prop="item.field"
                         :show-overflow-tooltip="true" :width="item.width">
            {{item.children}}
            <template v-if="item.children">
                <businessTableItem :tableColumnList="item.children"></businessTableItem>
            </template>
            <template v-if="item.isSlot">
                <slot :name="item.field"></slot>
            </template>
        </el-table-column>

使用时调用businesstable组件传入tableColumnList 和tableData

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值