API

February 22, 2019 · View on GitHub

Attributes

AttributeDescriptionTypeAccepted ValuesDefault
fetchA function to get remote data, it will get a object of search params as arguments, and return a promise. If it fetch is provided, will not get remote data from url.function--
typeData source type. It has two types of 'remote' and 'local'.stringremote, localremote
dataData list, only avaliable when type is 'local'array--
urlRequest URLstring--
methodRequest methodstringget, post, delete, putget
auto-loadWhether request remote data and show when component be createdbooleantrue, falsetrue
headersRequest headersobject--
list-fieldThe key to get list data from responsestring-data.list
total-fieldThe key to get total count of responsestring-data.total
paramsSearch params when send request to backendobject--
form-optionsform item settings(See Form Option Attributes below)object--
data-handlerFunction as parameter of Array.map to hander list datafunction--
columnsArray of table column settings object. See Table column Attributes belowarray--
show-paginationWhether to show pagination component, if it's false, request parameters will not contain pagination parameters(pageIndex, pageSize)boolean-true
page-sizesOptions of item count per pagearray-[20, 50, 100]
pagination-layoutLayout of pagination, elements separated with a commastringsizes, prev, pager, next, jumper, ->, total, slottotal, prev, pager, next, jumper, sizes
page-index-keyThe key of pagination parameter of page indexstring-pageIndex
page-size-keyThe key of pagination parameter of page sizestring-pageSize
table-styleCSS Styles which will be passed to el-tablestring-width:100%;margin-top:20px;

PS: Also support more attributes, please refer to Element UI Table attributes

Supported attributes of Element UI Table: stripe / border / height / max-height / fit / show-header / highlight-current-row / current-row-key / row-class-name / row-style / row-key / empty-text / default-expand-all / expand-row-keys / default-sort / tooltip-effect / show-summary / sum-text / summary-method / size.

Table column Attributes

AttributeDescriptionTypeAccepted ValuesDefault
propcolumn key valuestring--
labelcolumn show valuestring--
widthcolumn widthnumber-140
minWidthmin column widthnumber--
filterfilter name, only avaliable for registed on global Vuestring--
renderfunction to handle data, and show the return value. The function will have the element of list data as parameterfunction--
slotNameuse slot to wrap a code block to build column contentstring--
typeSupported after version0.4.28. This is a supported property on Element UI Table. We try to use this property to distinguish adding slot content to column or not, so that we can support new features but keep the compabilities. Without setting this property, we will keep same behavior as the previous version, which will take certain column definitions and pass to Element UI Table Column object, and we will handle some custom functions such as render, formatter, etc. But when this property has been set with a value, we will simply pass anything from column defintion to Element UI Table Column. In this way, we can also support multi selection feature, index col feature, etc. Setting type to default will also let Element UI Table Column take over the rendering which will simply take prop from data object with filter setting considered.stringdefault/selection/index/expand

PS: Also support more attributes, please refer to Element UI Table column Attribute

Supported attributes of Element UI Table column: column-key / fixed / render-header / sortable / sort-by / sort-method / resizable / formatter / show-overflow-tooltip / align / header-align / class-name / label-class-name / selectable / reserve-selection / filters / filter-placement / filter-multiple / filter-method / filtered-value / type.

PS: Attribute formatter won't work if renderer or filter has been defined.

Form Option Attributes

AttributeDescriptionTypeAccepted ValuesDefault
formsArray of object about form item settings.See Form Item Attributesarray[object]--
sizesize of form itemstringlarge/small/mini-
showResetBtnwhether to show the reset buttonboolean-false
inlinewhether the form is inlineboolean-false
fuzzywhether the form support fuzzy search, global setting, only avaliable for local databoolean-false
labelWidthwidth of form label, and all its direct child form items will inherit this valuenumber--
itemWidthwidth of form item, and all its direct child form items will inherit this valuenumber--
submitHandlerfunction to hander click event of submit button, the will receive the form object as the first argumentfunction--
submitLoadingdetemine whether the button is loadingboolean--
submitBtnTexttext of submit buttonstring-查询
resetBtnTexttext of reset buttonstring-重置
resetBtnCallbackcallback function in reset button's click event handler, will be called after resetting the search paramsfunction--

Form Item Attributes

AttributeDescriptionTypeAccepted ValuesDefault
labelform item label valuestring--
propform item prop's keystring--
fuzzywhether form item support fuzzy search, only avaliable for local databoolean-false
itemTypeform item type, Recently, only input/select/date/daterange are avaliablestringinput/select/date/daterange-
sizeform item sizestringlarge/small/mini-
labelWidthwidth of form label--
itemWidthwidth of form itemnumber--
placeholderplaceholder of form itemstring--
editablewhether the input is editable, only avaliable for date/daterangebooleantrue/falsetrue
disabledwhether the form item is disabledbooleantrue/falsefalse
readonlysame as readonly in native input, only avaliable for input/date/daterangebooleantrue/falsefalse
optionsarray of select options, the element of array can be string or object[string]/[object]--
selectFetchfunction to get remote data for select options, the function must return a promise, and only avaliable without the attribute selectUrlfunction--
selectResultFieldthe key value of remote data, default value is resultstring-
selectResultHandlerfunction as parameter of Array.map to hander remote data of select optionsfunction--
selectUrlurl of remote select optionsstring --
selectMethodmethod type for remote url(selectUrl)stringget/post-
selectParamsthe params of remote urlobject--
valueKeythe key of select options's value attribute, only avaliable when the type of options element's is objectstring-value
labelKeythe key of select options's label attribute, only avaliable when the type of options element's is objectstring-label
rulesvalidation rules of formobject--
formata function to foramt form item value, it receive two arguments: form item value and form item key(as prop), and the function should return the formatted valuefunction--
pickerOptionsadditional options, only avaliable for date/daterangeobject--

Methods

Method NameDescriptionParameters
searchHandlerResearch, and default reset page index to 1, set false to prevent resetting page indexresetPageIndex: boolean

Slots

Slot NameDescription
formA form above table component to contain parameters. this slot's scope has two properties:
loading: request loading of Element Loading directive; search: research function
prependThis slot will be appended as the far lest column of the table
appendThis slot will be appended as the far right column of the table

Events

Event NameDescriptionParameters
selecttriggers when user clicks the checkbox in a rowselection, row
select-alltriggers when user clicks the checkbox in table headerselection
selection-changetriggers when selection changesselection
cell-mouse-entertriggers when hovering into a cellrow, column, cell, event
cell-mouse-leavetriggers when hovering out of a cellrow, column, cell, event
cell-clicktriggers when clicking a cellrow, column, cell, event
cell-dblclicktriggers when double clicking a cellrow, column, cell, event
row-clicktriggers when clicking a rowrow, event, column
row-contextmenutriggers when user right clicks on a rowrow, event
row-dblclicktriggers when double clicking a rowrow, event
header-clicktriggers when clicking a column headercolumn, event
sort-changetriggers when Table's sorting changes{ column, prop, order }
filter-changecolumn's key. If you need to use the filter-change event, this attribute is mandatory to identify which column is being filteredfilters
current-changetriggers when current row changescurrentRow, oldCurrentRow
header-dragendtriggers when finish dragging headernewWidth, oldWidth, column, event
expand (v1.x)triggers when user expands or collapses a rowrow, expandedRows
expand-change (v2.x)triggers when user expands or collapses a rowrow, expandedRows