MineAdmin 交流群

官方QQ群: 150105478

Skip to content

MaForm

A Form component based on the secondary encapsulation of Element plus, supporting all native form parameters, events, slots, and syntax. It also supports configuration-based implementation. Additionally, it supports layout planning for forms based on el-row and el-space.

Note

Since it fully supports and is compatible with all parameters, events, and slots of the native el-form, only the extended parameters are discussed here.

For official form parameters, please refer to the Element plus official documentation.

Configuration-based Usage

Template-based Usage

Getting Component and el-form-item Ref

Tip

This method is for configuration form. In template, you can define ref yourself.

Props

ParameterDescriptionTypeEle-Official DocumentationVersion
v-modelma-form data, two-way bindingMaModel-1.0.0
optionsel-form parameters and extended parametersMaFormOptionsForm Attributes1.0.0
itemsma-form-item parametersMaFormItem[]-1.0.0

ExtraProps

Note

These are the extended parameters of ma-form for el-form.

ParameterDescriptionTypeDefaultVersion
containerClassForm container class namestring-1.0.0
loadingWhether to enable loading animationbooleanfalse1.0.0
loadingConfigLoading animation related configurationLoadingConfig-1.0.0
layoutHover to viewflex, gridflex1.0.0
gridHover to viewel-space documentation-1.0.0
flexHover to viewel-row documentation-1.0.0
footerSlotHover to view() => {}-1.0.0

LoadingConfig Description

ParameterDescriptionTypeDefaultVersion
textLoading text displayed below the loading iconstring-1.0.0
spinnerCustom loading iconstring-1.0.0
svgCustom svg loading iconstring-1.0.0
viewBoxSize of the loading iconstring-1.0.0
backgroundBackground mask colorstring-1.0.0
customClassCustom class namestring-1.0.0

MaFormItem

ParameterDescriptionTypeDefaultVersion
labelEnhanced native parameter, added support for function typestring, () => string-1.0.0
propEnhanced native parameter, added support for function typestring, () => string-1.0.0
hideHover to viewHover to viewfalse1.0.0
showHover to viewHover to viewtrue1.0.0
colsEffective when options.layout is flexel-col documentation-1.0.0
itemPropsel-form-item native propertiesForm Item Attributes-1.0.0
itemSlotsel-form-item native slotsForm Item Slots-1.0.0
renderRender component: Hover to viewstring, (data) => any-1.0.0
renderPropsprops properties of the rendered componentRecord<string, any>-1.0.0
renderSlotsSlots of the rendered componentRecord<string, (...args) => {}>-1.0.0

Slot

NameDescriptionParameters
defaultDefault slot, can write native tags <el-form-item>, configuration method automatically invalid-
footerForm footer slot-

Expose

NameDescriptionParametersReturn Value
setLoadingState()Set form loading state(boolean)-
setOptions()Set ma-form configuration(MaFormOptions)-
getOptions()Get ma-form configuration-MaFormOptions
setItems()Set form items(MaFormItem[])-
getItems()Get form items-MaFormItem[]
appendItem()Append form item(MaFormItem)-
removeItem()Remove form item(prop: string)-
getItemByProp()Get form item by prop(prop: string)MaFormItem
isMobileState()Check if it is mobile mode-boolean
getElFormRef()Get el-form Ref-El-Form

致力于为品牌和企业创造价值