gt-table

0.0.3 • Public • Published

文档

封装了 table+pagination. 高度为父元素的 100%

Api

refresh() 刷新当前数据

reload() 重置 pagination,获取数据

resize() 重置 max-height 高度

参数 类型 默认 是否必填 描述
tableProps Object null false table 组件支持的 props
tableEvents Object null false table 组件支持的 events
process Function ()=>{} false 生成数据的函数
pagination Object,Bolean null false 分页器配置,false 值不显示

slot:

参数 描述
batchActions table pagination 左侧的批量操作按钮区域
    <gt-table ref="table" :tableProps="tableProps" :pagination="pagination" :process="process">
        <el-table-column label="序号" width="50" prop="id"></el-table-column>
    </gt-table>
    export default {
        data(){
            return {
                tableProps:{
                    'header-cell-style': { background: '#F6F5F7' },
                },
                pagination:{},
            }
        },
        methods:{
            process({pageSize,currentPage}){
                this.$api.getData({
                    params:{
                        pageSize,
                        currentPage
                    }
                }).then(({content,total})=>{
                    this.$set(this.tableProps, 'data', content);
                    this.$set(this.pagination, 'total', total);
                })
            },
            reload(){
                this.$refs.table.reload();
                // 从初始页面重新加载
            },
            refresh(){
                this.$refs.table.refresh();
                // 刷新当前页
            }
        }
    }

Readme

Keywords

none

Package Sidebar

Install

npm i gt-table

Weekly Downloads

1

Version

0.0.3

License

none

Unpacked Size

10.9 kB

Total Files

8

Last publish

Collaborators

  • fm353488931