官網:https://vxeui.com
<template>
<div>
<vxe-form
v-bind="formOptions"
@submit="submitEvent"
@reset="resetEvent">
</vxe-form>
</div>
</template>
<script>
import { VxeUI } from 'vxe-pc-ui'
export default {
data () {
const formOptions = {
data: {
name: 'test1',
nickname: '',
sex: '',
age: '',
address: ''
},
items: [
{ field: 'name', title: '名稱', span: 24, itemRender: { name: 'VxeInput' } },
{ field: 'sex', title: '性別', span: 12, itemRender: { name: 'VxeInput' } },
{ field: 'age', title: '年齡', span: 12, itemRender: { name: 'VxeInput' } },
{ field: 'address', title: '地址', span: 24, itemRender: { name: 'VxeTextarea' } },
{
align: 'center',
span: 24,
itemRender: {
name: 'VxeButtonGroup',
options: [
{ type: 'submit', content: '提交', status: 'primary' },
{ type: 'reset', content: '重置' }
]
}
}
]
}
return {
formOptions
}
},
methods: {
submitEvent () {
VxeUI.modal.message({ content: '儲存成功', status: 'success' })
},
resetEvent () {
VxeUI.modal.message({ content: '重置事件', status: 'info' })
}
}
}
</script>
https://gitee.com/x-extends/vxe-pc-ui