2.2.0 • Published 3 years ago

vue-pg-table v2.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

vue-pg-table

A paginated table component based element-ui

Install

npm install vue-pg-table

Usage

import PgTable form 'vue-pg-table';
export default {
  components: {
    [PgTable.name]: PgTable
  }
}
  • common demo.
<pg-table
  :data="tableData"
  :columns="tableColumns"
  :pagination.sync="pagination"
  row-key="id"
  min-height="500"
  style="width: 100%"
  @query="queryData"
></pg-table>
  • With slots <el-table-column> and columns props.
    The order is loop the columns and then inject the slot to after.
    Also provide the action slot after the deafult slot.
<pg-table 
  :data="tableData" 
  :columns="tableColumns" 
  :pagination.sync="pagination"
  row-key="id"
  style="width: 100%"
  header-row-class-name="thead-light"
  @sort-change="sortChange"
  @selection-change="selectionChange">
  <el-table-column width="180px" align="center" label="Actions">
    <div slot-scope="{$index, row}" class="p-1">
      <el-button
        v-if="perm('role:edit')"
        @click.native="handleEdit($index, row)"
      >
        编辑菜单权限
      </el-button>
    </div>
  </el-table-column>
</pg-table>

Props

NameTypeDefaultDescription
columnsArray[]table columns
paginationObjectsee the followpagination
pagination.currentPagenumbersee the follow当前页数,支持 .sync 修饰符
pagination.pageSizenumbersee the follow每页显示条目个数,支持 .sync 修饰符
pagination.backgroundboolentruebackground
...

inherit All <el-table> props see the documents

https://element.eleme.io/#/zh-CN/component/table

inherit All <el-pagination> props with default Props

    background: true
    pageSizes: [10, 20, 50, 100],
    total: 0,
    pageSize: 10,
    currentPage: 1

https://element.eleme.io/#/zh-CN/component/pagination

Events

NameDescription
querywatch to query the data

Slots

NameDescription
default slot
actionaction slot

Donate

License

Copyright (c) Terry Cai. Licensed under the MIT license.

2.2.0

3 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.2

4 years ago

2.1.0

4 years ago