Skip to content

Crud Attributes Documentation

js
// crud component global configuration
app.use(XCrud)

Crud

ParameterDescriptionType
v-model:formBound form valueobject
dataData to displayarray
optionForm configuration options, refer to Option configurationTableOption
before-openCallback before the dialog form opens, which will pause the opening of the Dialog. done is used to open the Dialog, type (check/view, create/add, update/edit) is the type of the current window, row is the data bound to the dialog form, which is undefined when adding
Function
dialog-closeCallback before the dialog closes, type is the type of the current window
Function
permissionControl permissions for multiple buttons in the table, using functions for precise row controlCrudPermission
searchSearch variablesobject
pagePagination variables, refer to Page parametersCrudPageProps
span-methodCalculation method for merging rows or columns
Function
summary-methodCustom summary calculation method
Function

Page

ParameterDescriptionTypeDefault Value
currentPageCurrent page numbernumber1
pageSizeNumber of items displayed per pagenumber10
totalTotal number of itemsnumber0
backgroundWhether to add background color to pagination buttonsbooleantrue
layoutComponent layout, separated by commas for subcomponent names
Array
[total, sizes, prev, pager, next, jumper]
pageSizesOption settings for the number of items displayed per pagenumber[][10, 20, 30, 40]

Option

ParameterDescriptionTypeDefault Value
titleTable titlestring | VNode-
heightTable heightstring-
maxHeightMaximum height of the table. Valid values are numbers or heights in pxstring-
indexWhether to display a serial number columnbooleanfalse
indexTextSerial number column text contentstringSerial Number
lazyWhether the table component lazy-loads child node databooleanfalse
borderWhether to have vertical bordersbooleanfalse
labelWidthText width of form itemsnumber90
selectionWhether to have a selection checkboxbooleanfalse
selectionWidthCheckbox column widthstring50
rowKeyKey of row data, used to optimize table rendering; Required when using reserve-selection functionality and displaying tree datastringid
menuWhether to display the operation barbooleanfalse
menuTitleOperation bar titlestringOperation
menuWidthOperation bar widthstring220px
menuMinWidthMinimum width of the operation barstring220px
menuFixedWhether the operation bar column is fixed to the left or right. true means fixed to the leftboolean | left | rightright
menuHeaderAlignAlignment of the operation bar headerleft | center | rightcenter
sortableWhether to enable drag-and-drop sortingbooleanfalse
menuHeaderRightWhether to display the right side of the table header menu barbooleantrue
columnHeader configurationColumnProps[]Details-
groupForm groupingTableGroupInterface[]-
tableLoadingControl of the table loading indicatorbooleanfalse
highlightCurrentRowWhether to highlight the current rowbooleanfalse
searchLabelWidthSearch item title widthnumber90
searchSpanSearch item grid spannumber8
defaultExpandAllWhether to expand all rows by default, valid when the table contains expandable rows or is a tree tablebooleanfalse
isDrawerWhether the dialog is a drawerbooleanfalse
addTitleTable add dialog titlestringAdd
editTitleTable edit dialog titlestringEdit
viewTitleTable view dialog titlestringView
dialogWidthTable dialog widthstring80%
addBtnTable add buttonbooleanfalse
delBtnTable delete buttonbooleanfalse
viewBtnTable view buttonbooleanfalse
updateBtnUpdate buttonbooleanfalse
importBtnTable import buttonbooleanfalse
excelBtnTable export buttonbooleanfalse
viewTabsTabs for viewViewTabs[]-
isCardWhether to display as cardbooleantrue
menuBtnWhether to display the form operation barbooleantrue
cancelBtnTable dialog cancel buttonbooleantrue
submitBtnTable dialog submit buttonbooleantrue
submitBtnTextTable dialog submit button textstringSubmit

Column

ParameterDescriptionTypeDefault Value
labelColumn headerstring | VNode-
propProperty name for column header contentstring-
componentBindOther values that need to be bound to form items, required when type is selectPeople/regionalGridstring-
typeForm item type
FormItemType
input
spanForm item grid spannumber12
alignAlignment
enum
left
headerAlignHeader alignment, if not set, the table's alignment is used, default is left
enum
left
fixedWhether the column is fixed to the left or right. true means fixed to the left
enum
-
widthColumn widthnumber | string90
minWidthMinimum column width. The difference with width is that width is fixed, while min-width distributes the remaining width proportionally to columns with min-width setnumber | string-
showOverflowTooltipDisplay when content is too longbooleanfalse
formatterUsed to format content
Function
classNameColumn classNamestring-
labelClassNameColumn classNamestring-
propsConfiguration object for dictionary propertiesPropsInterface{label: 'label', value: 'value'}
dicDataDictionary valuesDicDataInterface-
dicAjaxResolveData returned by the dictionary interface functionPromise<any>-
searchSpanSearch item grid spannumber8
menuSpanGrid span for the search bar operation areanumber-
searchLabelWidthSearch item title widthnumber90
searchWhether it is a search itemboolean-
searchPlaceholderSearch item placeholder textstring-
searchTypeSearch item type, default search item type, if not configured, it takes the type configurationFormItemTypeinput
searchClearableSearch item clearablebooleantrue
rulesForm validation rules
RulesType
-
displayWhether the current item in the popup form is displayed
boolean | Function
true
createDisplayWhether the current item is displayed when adding a form
boolean | Function
true
updateDisplayWhether the current item is displayed when editing a form
boolean | Function
true
checkDisplayWhether the current item is displayed when viewing a form
boolean | Function
true
disabledWhether the current item in the popup form is disabledbooleanfalse`
createDisabledWhether the current item is displayed when adding a formbooleanfalse
updateDisabledWhether the current item is displayed when editing a formbooleanfalse
checkDisabledWhether the current item is displayed when viewing a formbooleanfalse
labelWidthForm item title widthnumber90
hideWhether the table item is hiddenbooleanfalse
setUpHideColumns not displayed can be controlled to display through operationsbooleanfalse
orderForm item position sorting, the larger the number, the more forwardnumber1
searchOrderSearch bar position sorting, the larger the number, the more forwardnumber1
tipHelper text for contentstring | VNode-
tipPlacementPosition of helper text
enum
right-start
styleForm item styleCSSProperties-
sortableEnable sorting based on this columnbooleanfalse
onCollection of event objectson?: {[key: string]: (event: any) => void}-

input

ParameterDescriptionTypeDefault Value
maxlengthMaximum input lengthstring | number-
minlengthNative property, minimum input lengthnumber-
show-word-limitWhether to display input word count, only valid when type = "text" or type = "textarea"booleanfalse
placeholderInput placeholder textstring-
clearableWhether is clearablebooleanfalse
sizeInput size, only valid when type is not 'textarea'
enum
default

inputNumber

type equals textarea's effective configuration items, refer to el-input-number for details

textarea

type equals textarea's effective configuration items, refer to el-textarea for details

select

type equals select's effective configuration items, refer to el-select for details

checkbox

type equals checkbox's effective configuration items, refer to el-checkbox for details

radio

type equals radio's effective configuration items, refer to el-radio for details

radioButton

type equals radioButton's effective configuration items, refer to el-radio for details

datePicker

type equals datePicker's effective configuration items, refer to el-date-picker for details

cascader

type equals cascader's effective configuration items, refer to el-cascader for details

switch

type equals switch's effective configuration items, refer to el-switch for details

treeSelect

type equals treeSelect's effective configuration items, refer to el-tree-select for details

editTable

type equals editTable's effective configuration items, refer to editTable for details

Group

ParameterDescriptionTypeOptional ValuesDefault Value
labelGroup titlestring | VNode--
propProperty name for form groupingstring--
slotWhether is a slotboolean--
columnForm itemsFormColumnProps[]Details--

Events

Event NameDescriptionTypeCallback Parameters
row-saveTriggered after clicking confirm when adding data
Function
row is the data bound to the form, done is the function to close the dialog, isClear defaults to true to close the dialog and clear the form, isClear/false only clears the button loading effect
row-updateTriggered after clicking confirm when editing data
Function
row is the data bound to the form, done is the function to close the dialog, isClear defaults to true to close the dialog and clear the form, isClear/false only clears the button loading effect
row-delTriggered after deleting data
Function
row is the data corresponding to the table item, index is the clicked table item
row-clickTriggered when a row is clicked
Function
row is the data corresponding to the table item
selection-changeTriggered when multiple items are selected in the table
Function
selection is the data selected in the table
current-changeTable
Function
currentPage is the current page number

Methods

Method NameDescriptionTypeParameters
doLayoutRe-layout the Table. When the table visibility changes, you may need to call this method to get the correct layoutFunction-
closeDialogFormClose the form dialogFunction-
openDialogFormOpen the dialog
Function
type dialog type check/view, create/add, update/edit, row table row data, index which row of the table
toggleRowRadioUsed for single selection table
Function
id corresponds to rowKey in table data, defaults to id
toggleRowSelectionUsed for multi-selection table, toggle the selected state of a row, if the second parameter is used, you can directly set whether this row is selected
Function
row table row data, selected whether selected
validateUsed for form dialog form validation, will be deprecated in the next version, please use validateV2
Function
callback callback function triggered after form submission
scrollToFieldUsed for form dialog, scroll to the specified field
Function
prop prop configuration in column
validateV2Form validation--
clearValidateRemove the validation results of the form item
Function
props is an array, each item in the array is the prop configuration in column
validateFieldValidate a specific field
Function
props is an array, each item in the array is the prop configuration in column

Slot

Slot NameDescriptionScope Parameters
headerMenuTable header operation bar slot-
menuOperation bar slot-
pagePagination slot-
formForm slot-
propTable slot, using the prop from Column as the slot name, for example, if column: [{prop: 'test'}], the slot name is #test{ row, $index }
propSearchSearch bar slot, using the prop from Column concatenated with Search as the slot name, for example, if column: [{prop: 'test'}], the slot name is #testSearch{ row }
propFormForm slot, using the prop from Column concatenated with Form as the slot name, for example, if column: [{prop: 'test'}], the slot name is #testForm scope parameter is-
propGroupFormForm grouping slot, using the prop from Group concatenated with Group as the slot name, for example, if group: [{prop: 'test'}], the slot name is #testGroupForm{ _XBoxType?: 'check' | 'create' | 'update' }
propTabFormForm tab slot, using the value from ViewTabs concatenated with TabForm as the slot name, for example, if viewTabs: [{value: 'test'}], the slot name is #testTabForm{ _XBoxType?: 'check' | 'create' | 'update' }
importHeaderImport file header slot-
formHeaderForm dialog header position slot{ _XBoxType?: 'check' | 'create' | 'update' }
formFooterForm dialog footer position slot{ _XBoxType?: 'check' | 'create' | 'update' }