0.0.3 • Published 6 months ago

gt-table v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

文档

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

Api

refresh() 刷新当前数据

reload() 重置 pagination,获取数据

resize() 重置 max-height 高度

参数类型默认是否必填描述
tablePropsObjectnullfalsetable 组件支持的 props
tableEventsObjectnullfalsetable 组件支持的 events
processFunction()=>{}false生成数据的函数
paginationObject,Boleannullfalse分页器配置,false 值不显示

slot:

参数描述
batchActionstable 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();
                // 刷新当前页
            }
        }
    }
0.0.3

6 months ago