Vue Element UI Table 自动生成 el-table 表封装 实例 2.0(详细教程)

Element UI Table 表封装

文章解析

table 组件封装

条件分页获取数据
自定义table 表头
自定义table 权限
自定义字段是否必须
自定义是否自动分页
自定义日期格式
监听发送权限操作
返回调用者信息
table 数据可视化面板

文章必读

Vue http 请求封装包
Element UI Table 分页教程
Vue 组件通信

Template

<template>
  <div class="container-fluid">
    <div class="container-fluid card" v-show="props.datapanel">
      <h4>table Data</h4>
      <span>
      <ul class="border-secondary-50 p-0 m-0 border" style="list-style: none;" v-for="(prop,index) in props">
        <li class="d-flex flex-row text-left"><span
          class="font-weight-bolder">{
  {index}}:</span><span>{
  {prop}}</span></li>
      </ul>
      </span>
    </div>
    <el-table v-if="!props.selfmotionpage" highlight-current-row border
              :data="!props.selfmotionpage?tableData:tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
              class="w-auto">
      <template v-for="(col ,index) in props.cols">

        <el-table-column v-if="col.type==='String'&&col.dataIdentification===''&&col.hidden!=='true'" :prop="col.prop"
                         :label="col.label"
                         :width="col.width" :sortable="col.sort==='sort'?true:false"
        ></el-table-column>
        &lt;!&ndash;date&ndash;&gt;
        <el-table-column v-if="col.type==='date'&&col.hidden!=='true'" :prop="col.prop" :label="col.label"
                         :formatter="dateFormat"
                         :sortable="col.sort==='sort'?true:false"
                         :width="col.width"></el-ta
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值