docs: improve docs and update api

This commit is contained in:
Justineo
2021-11-24 12:05:27 +08:00
parent a790f0d8a9
commit 5226ec968c
19 changed files with 297 additions and 114 deletions

View File

@@ -25,6 +25,8 @@ See [the demos of `Table`](./table#demos).
| ``filter-multiple`` | `boolean=` | `false` | Whether the built-in filter is multi-select or not. |
| ``filter-options`` | `Array<Object>` | - | The list of filter options, with items of type `{label, value, options, disabled, ...}`, see the [`options`](./select#options) prop of the [`Select`](./select) component. |
| ``filter-title`` | `string=` | - | The title of the filter dropdown. |
| ``allowed-orders`` | `Array` | `[false, 'desc', 'asc']` | [^allowed-orders] |
| ``tooltip`` | `boolean | ((item: Object) => string)` | - | Whether to automatically show tooltips when content overflows. The tooltip displays the field corresponding to the [`field`](#props-field) prop of the [`data`](. /table#props-data) prop of `Table` component the current column belongs to. When being a function, the `item` argument is the entire data item and the returned string will be displayed as tooltip content. |
^^^sortable
Whether current column is sortable.

View File

@@ -6,11 +6,19 @@
[[ demo src="/demo/pagination/size.vue" ]]
### Go to a specific page
### Page size
Use the [`goto`](#props-goto) prop to enable the go to page section.
Use the [`page-size`](#props-page-size) prop to specify the current page size.
[[ demo src="/demo/pagination/goto.vue" ]]
Use the [`page-sizes`](#props-page-sizes) prop to specify the page size options.
[[ demo src="/demo/pagination/pages.vue" ]]
### Optional parts
Use the [`show-total`](#props-show-total) / [`show-page-size`](#props-show-page-size) / [`show-goto`](#props-show-goto) props to control the visibility of the total items / page size selector / goto page parts.
[[ demo src="/demo/pagination/parts.vue" ]]
## API
@@ -20,12 +28,14 @@ Use the [`goto`](#props-goto) prop to enable the go to page section.
| -- | -- | -- | -- |
| ``ui`` | `string=` | - | [^ui] |
| ``page`` | `number` | `1` | Current page index (starts from `1`). |
| ``total`` | `number` | - | Total page count. |
| ``total`` | `number` | - | Total items count. |
| ``to`` | `string | Object` | `''` | [^to] |
| ``native`` | `boolean` | `false` | Use native links for navigation. |
| ``page-size`` | `number` | `pagination.pageSize` | [^page-size] |
| ``page-sizes`` | `Array` | `pagination.pageSizes` | The predefined available page sizes for users to select. |
| ``goto`` | `boolean` | `false` | Whether to show goto page number” section. |
| ``show-goto`` | `boolean=` | `false` | Whether to show the go to page section. |
| ``show-total`` | `boolean=` | `false` | Whether to show the total page count. |
| ``show-page-size`` | `boolean=` | `false` | Whether to show the page size selection section. |
^^^ui
Style variants.
@@ -55,7 +65,7 @@ The count of item in each page.
| Name | Description |
| -- | -- |
| ``pagesizechange`` | Triggered when `page-size` is changed. The callback parameter list is `(size: number)`, with `size` being the new `page-size` value. |
| ``pagesizechange`` | Triggered when page size is changed. The callback parameter list is `(size: number)`, with `size` being the new page size value. |
| ``redirect`` | Triggered when page links are activated. The callback parameter list is `(page: number, event: Object)`. `page` is the number of the targe page. `event` is the native event object, calling `event.preventDefault` will stop navigation when `native` is `true`. |
### Configs

View File

@@ -12,7 +12,7 @@ Available density variants for the [`ui`](#props-ui) prop: `compact` / `loose`.
[[ demo src="/demo/table/basic.vue" ]]
### Advanced
### Selection and sorting
Supports specifying row keys, mode of selection, and sorting by values of specific column.
@@ -48,6 +48,12 @@ Use the [`desc`](./column#props-desc) prop or the [`desc`](./column#slots-desc)
[[ demo src="/demo/table/desc.vue" ]]
### Truncation tooltips
Use the [`tooltip`](./column#props-tooltip) attribute of the `Column` component to specify that a hover tooltip is displayed when the content is truncated.
[[ demo src="/demo/table/tooltip.vue" ]]]
## API
### Props