0.1.0-beta4 • Published 3 years ago

antd-col-table v0.1.0-beta4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

ant-dynamic-table

一、安装及引入

安装包

yarn add antd-dynamic-table -s

项目中引入包

import AntdDynamicTable from 'antd-dynamic-table'

注入Vue

Vue.use(VueAntdDynamicTable)

需要使用页面引入包

import { AntdDynamicTable } from "antd-dynamic-table"

组件注册

component: { AntdDynamicTable }

二、使用

例子

<AntdDynamicTable
    :id="mytable"
    :columns="columns"
    :dbData="data"
    :tableHeight="{ y: 'calc(100vh - 310px)' }"
    :canEdit="true"
    :canCheck="true"
    :singleCheck="true"
>
</AntdDynamicTable>

columns: [
    {
        title: "节日",
        dataIndex: "festival",
        width: 180,
        align: "center",
        sort: true,
        filter: true,
    },
    {
        title: "时间",
        dataIndex: "time",
        width: 180,
        align: "center",
        sort: true,
        filter: false,
    },
    {
        title: "假期长度",
        dataIndex: "holidayLength",
        width: 180,
        align: "center",
        sort: true,
        filter: true,
    }
],
data: [
    {
        festival: "元旦",
        time: '2021-01-01',
        holidayLength: 3,
    },
    {
        festival: "春节",
        time: '2021-02-11',
        holidayLength: 7,
    },
    {
        festival: "清明",
        time: '2021-04-03',
        holidayLength: 3,
    },
    {
        festival: "劳动节",
        time: '2021-05-01',
        holidayLength: 5,
    },
    {
        festival: "端午",
        time: '2021-06-12',
        holidayLength: 3,
    },
    {
        festival: "中秋",
        time: '2021-09-19',
        holidayLength: 3,
    },
    {
        festival: "国庆",
        time: '2021-10-01',
        holidayLength: 7,
    }
]

参数

参数名类型默认值作用
idString'dynamictable'id
columnsArraynull表格列
dbDataArraynull表格数据
tableHeightObject{ y: 500 }表格高度
rowKeyString'key'备注
singleCheckBooleanfalse是否为单选行
defaultSelectColArraynull默认显示列
canEditBooleanfalse是否可编辑
dynamicColBooleanfalse是否为动态控制列
spinningBooleanfalse加载是否显示等待
canCheckBooleantrue是否可选中
haveHeaderBooleantrue备注
showSumBooleanfalse是否自动合计
showFooterBooleanfalse是否显示页脚
borderedBooleanfalse是否显示边框
havePageInationBooleantrue是否显示分页
defaultSelectAllBooleanfalse默认选中全部