vue轻量级弹幕组件_轻量级的vue数据表组件,没有依赖项

vue轻量级弹幕组件

v-datatable-light (v-datatable-light)

A lightweight vue datatable component with no dependencies.

轻量级的vue数据表组件,没有依赖项。

用法 (Usage)

<DataTable
  :header-fields="headerFields"
  :data="data"
/>
import { DataTable } from 'v-datatable-light'

export default {
  components: {
    DataTable
  }
}

数据表道具 (DataTable Props)

FieldTypeRequireddefaultDescription
headerFieldsarraytruenullDefinition of each column of the table. In each item of this array you will define how this column will behave.
dataarraytruenullArray of objects that will feed the datatable.
isLoadingbooleanfalsefalseFlag to indicate to datatable if the data is loading. If it is, your spinner slot will be show.
sortFieldstringfalsenullTo indicate by which field the datatable is sorted for.
sortstringfalsenullTo indicate by which direction the databale is sorted for ('asc' or 'desc').
notFoundMsgstringfalsenullMessage to by show when no data was found.
trackBystringfalse'id'An unique id column used for checkbox column type to compare if a field is checked or not.
cssobjectfalseStructureAn object with attributes used to add css classes to DataTable internal elements.
tableHeightstringfalsenullUsed to have fixed header in the table.
defaultColumnWidthstringfalse'150px'Set the default column with, only used when 'tableHeight' prop is informed.
领域 类型 需要 默认 描述
headerFields 数组 真正 空值 表的每一列的定义。 在此数组的每个项目中,您都将定义此列的行为。
数据 数组 真正 空值 将提供数据表的对象数组。
isLoading 布尔值 指示数据表是否正在加载数据的标志。 如果是这样,将显示您的微调器插槽。
sortField 空值 指示数据表是按哪个字段排序的。
分类 空值 指示数据包按哪个方向排序(“ asc”或“ desc”)。
notFoundMsg 空值 找不到数据时显示的消息。
跟踪 'ID' 用于复选框列类型的唯一ID列,用于比较是否选中了字段。
CSS 目的 结构体 具有用于将CSS类添加到DataTable内部元素的属性的对象。
tableHeight 空值 用于在表中具有固定的标题。
defaultColumnWidth '150px' 设置默认列,仅在通知'tableHeight'属性时使用。

DataTable标头字段道具 (DataTable Header Fields Props)

NameTypeRequiredDefaultDescription
namestringtruenullAttribute that the DataTable will try to retrieve the value from the data item.
labelstringtruenullAttribute that the DataTable will show on the header for the column.
sortablebooleanfalsefalseDefine if that column will be sortable or not. In case the value is true, two arrows will be show on the header.
customElementbooleanstringfalsenull
formatfunctionfalsenullA function used to format a value in each line of the DataTable's body.
widthstringfalsenullString used to define column width. Only used when 'tableHeight' props is informed.
__slot:actionsstringfalsenullUsed to create a new column to be used for buttons or any kind of action. You have to inform the slot 'actions' and it will be rendered inside each line. In case you want to use more than one action in the same table, you can inform different IDs for each one, and this ID will be used as the slot ID. The format would be: __slot:actions:myActionID, in this case myActionID is the slot ID
__slot:checkboxesstringfalsenullUsed to create a column with a checkbox. Every time you check or uncheck an item an event is emited.
名称 类型 需要 默认 描述
名称 真正 空值 DataTable将尝试从数据项中检索值的属性。
标签 真正 空值 DataTable将在列标题上显示的属性。
可排序 布尔值 定义该列是否可排序。 如果该值为true,则标题上将显示两个箭头。
customElement 布尔值 空值
格式 功能 空值 用于格式化DataTable主体各行中的值的函数。
宽度 空值 用于定义列宽的字符串。 仅在通知“ tableHeight”道具时使用。
__slot:actions 空值 用于创建新列以用于按钮或任何类型的操作。 您必须告知广告位“操作”,它将在每一行中呈现。 如果您要在同一张表中使用多个动作,则可以为每个动作指定不同的ID,该ID将用作插槽ID。 格式为: __slot:actions:myActionID ,在这种情况下, myActionID是插槽ID
__slot:复选框 空值 用于创建带有复选框的列。 每次您选中或取消选中一个项目都会触发一个事件。

DataTable CSS道具结构 (DataTable Css Props Structure)

NameTypeRequiredDefaultDescription
tablestringfalse''Applied on the table element.
theadstringfalse''Applied on the table thead element.
theadTrstringfalse''Applied on the table thead tr elements.
theadThstringfalse''Applied on the table thead th elements.
tbodystringfalse''Applied on the table tbody element.
tbodyTrstringfalse''Applied on the table tbody tr elements.
tbodyTdstringfalse''Applied on the table tbody td elements.
tbodyTrSpinnerstringfalse''Applied on the table tbody tr element when the spinner is displayed.
tbodyTdSpinnerstringfalse''Applied on the table tbody td element when the spinner is displayed.
tfootstringfalse''Applied on the table tfoot element.
tfootTrstringfalse''Applied on the table tfoot tr element.
tfootTdstringfalse''Applied on the table tfoot td element.
footerstringfalse''Applied on the table tfoot div element wrapping the slots.
thWrapperstringfalse''Applied on div inside the table thead th element wrapping the column header content.
thWrapperCheckboxesstringfalse''Applied on div inside the table thead th element wrapping the column header content when it is a checkbox.
arrowsWrapperstringfalse''Applied on div inside the table thead th element wrapping the arrows.
arrowUpstringfalse''Applied on div inside the table thead th element where the arrow up is draw.
arrowDownstringfalse''Applied on div inside the table thead th element where the arrow down is draw.
checkboxHeaderstringfalse''Applied on the table thead checkbox element.
checkboxstringfalse''Applied on the table tbody checkbox elements.
notFoundTrstringfalse''Applied on the table tbody tr element when the data is empty.
notFoundTdstringfalse''Applied on the table tbody td element when the data is empty.
名称 类型 需要 默认 描述
'' 应用在表格元素上。
Thead '' 应用在表thead元素上。
剧院 '' 应用于表主题元素。
治疗 '' 应用于表格中的元素。
身体 '' 应用在表的tbody元素上。
tbodyTr '' 应用于表体t元素。
tbodyTd '' 在表体上应用了td元素。
tbodyTrSpinner '' 显示微调器时,将其应用到表tbody tr元素上。
tbodyTdSpinner '' 显示微调器时,将其应用于表tbody td元素。
foot '' 应用于桌子上的tfoot元素。
tfootTr '' 应用于表脚上的tr元素。
tfootTd '' 应用于表tfoot td元素。
页脚 '' 应用在包裹槽Kong的表脚div元素上。
包装器 '' 应用于div中的表格thead th元素,该元素包装了列标题内容。
thWrapperCheckboxes '' 应用于表格中的div元素时,表thead元素将包装列标题的内容作为复选框。
ArrowWrapper '' 应用在div表格内的thethe元素和环绕箭头的元素上。
arrowUp '' 应用于div表格内的theat元素内,绘制向上箭头。
向下箭头 '' 应用于div表中的thethe th元素内,绘制向下箭头。
复选框标题 '' 在表thead复选框元素上应用。
复选框 '' 应用在表的tbody复选框元素上。
notFoundTr '' 当数据为空时,应用于表tbody tr元素。
notFoundTd '' 当数据为空时,应用于表tbody td元素。

分页道具 (Pagination Props)

NameTypeRequiredDefaultDescription
totalItemsnumbertruenullTotal of items in your storage.
itemsPerPagenumberfalse10Number of items displayed per page.
pagenumberfalse1Current page index.
moveLastPagebooleanfalsetrueFlag to show or not the button to move to the last page.
moveFirstPagebooleanfalsetrueFlag to show or not the button to move to the first page.
moveNextPagebooleanfalsetrueFlag to show or not the button to move to the next page.
movePreviousPagebooleanfalsetrueFlag to show or not the button to move to the previous page.
名称 类型 需要 默认 描述
totalItems 真正 空值 您存储中的项目总数。
每页项目 10 每页显示的项目数。
1个 当前页面索引。
moveLastPage 布尔值 真正 标记显示或不显示按钮以移至最后一页。
moveFirstPage 布尔值 真正 标记显示或不显示按钮以移至第一页。
moveNextPage 布尔值 真正 标记显示或不显示按钮以移至下一页。
movePreviousPage 布尔值 真正 标记显示或不显示按钮以移至上一页。

ItemsPerPageDropdown道具 (ItemsPerPageDropdown Props)

NameTypeRequiredDefaultDescription
listItemsPerPagearrayfalse[10, 20, 30]An array of numbers which the user will have the posibily to change how many items are displayed in the DataTable.
itemsPerPagenumberfalse10Current value of how many items are displayed on the DataTable.
名称 类型 需要 默认 描述
listItemsPerPage 数组 [10,20,30] 用户可以随意更改数字表中显示的项目数的数组。
每页项目 10 数据表上显示多少个项目的当前值。

安装 (Installation)

npm install v-datatable-light

项目设置 (Project setup)

npm install

编译和热重装以进行开发 (Compiles and hot-reloads for development)

npm run serve

编译并最小化生产 (Compiles and minifies for production)

npm run build

运行测试 (Run your tests)

npm run test

整理和修复文件 (Lints and fixes files)

npm run lint

翻译自: https://vuejsexamples.com/a-lightweight-vue-datatable-component-with-no-dependencies/

vue轻量级弹幕组件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值