1.0.0 • Published 4 years ago

@springleo/el-table-plus v1.0.0

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

el-table-plus npm.io

Install

yarn add @springleo/el-table-plus

Online Example

https://lq782655835.github.io/el-table-plus

Quick Start

Import modules and set up settings in main.js:

import ElTablePlus from '@springleo/el-table-plus'
Vue.use(ElTablePlus)

use <el-table-plus> in your page

<template>
    <el-table-plus
      :data="list"
      :columns="[
        { label: 'ID', value: 'id', width: '80px' },
        { label: '存储卷名', value: 'name' },
        { label: '总容量', value: 'storage', fn: val => `${val}G` },
        { label: '创建人', value: 'member.userId' },
        { label: '邮箱', value: 'member.email' },
        { label: '创建时间', value: 'gmtCreate' }
      ]"
    />
</template>

API

el-table-plus 属性

支持el-table上所有原有属性,同时扩展以下api。

参数类型默认值说明
loadingBooleanfalse动效loading
dataArray[]列表数据
columnsArray[]column item配置列表,详细见如下columns Attrs
paginationObject翻页器配置,默认未设置,不显示翻页器。相关api可查看el-pagination
totalNumber0翻页器条数总数

el-table-plus 事件

支持el-table上所有原有事件,同时扩展以下api。

事件名称说明Description
scrolltable滚动条事件e
page-change翻页器改变事件{ pageSize, currentPage }

columns 属性

支持el-table-column所有原有属性Scoped Slot,同时扩展以下api:

AttrTypeDefaultDescription
labelString列名称
propString列数据字段,支持多层对象嵌套,如user.email.prefix
fnFunction格式化列。函数参数(value, row, column, $index)
hiddenBoolean是否隐藏该列。建议是一个computed,使得可以响应式显示隐藏
customRenderFunction自定义列数据渲染。函数参数(value, row, column, $index, h),支持jsx和h函数
customTitleFunction自定义列头部渲染。函数参数(column, $index, h),支持jsx和h函数
scopedSlotsObject使用slot方式自定义渲染,替换customRender/customTitle函数。比如:{ customRender: 'slotName1', customTitle: 'slotName2' }

License

MIT