np-table Table

A configuration-driven table that dynamically generates the table through columns, simple to use and highly extensible.

Basic Usage

The table is dynamically generated by configuring columns through option, and data is fetched through api.fetch.

浏览器不支持,请手动复制 basic.en.vue

Component Configuration

Props

PropDescriptionTypeDefault
optionConfigurationTableOption-

Types

The component exports the following type definitions:

import type { TableOption, TableColumn, TableFilter } from 'naive-plus'

TableOption

PropDescriptionTypeDefault
columnsTable columnsArray<TableColumn>-
apiData API{ fetch: (pageParams, otherParams) => Promise<{ items, itemCount? }> }-
propsTable props, passed through to n-data-table. To prevent the table's internal vertical scroll from covering page content, scroll-related configs like maxHeight, flexHeight, and virtualScroll will be ignoredobject-
paginationPagination config; set to false to disable paginationfalse / PaginationConfig-
filtersFilter configArray<TableFilter>-

TableColumn

PropDescriptionTypeDefault
keyColumn field namestring-
titleColumn titlestring / ComputedRef<string>-
renderCustom render function(rowData, rowIndex) => VNode-
typeColumn type'selection' / 'index' / 'expand'-
widthColumn widthstring / number-
minWidthMin column widthstring / number-
fixedFixed column'left' / 'right'-
displayWhether to display the columnbooleantrue