51 lines
1.1 KiB
Vue
51 lines
1.1 KiB
Vue
<template>
|
|
<BasicForm @register="registerForm" />
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { BasicForm, useForm } from '@/components/Form';
|
|
import { useMessage } from '@/hooks/web/useMessage';
|
|
|
|
const { createMessage } = useMessage();
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
|
|
labelWidth: 100,
|
|
baseColProps: { span: 24 },
|
|
schemas: [
|
|
{
|
|
field: 'id',
|
|
label: '角色名称',
|
|
required: true,
|
|
component: 'Input',
|
|
ifShow: false,
|
|
},
|
|
{
|
|
field: 'name',
|
|
label: '角色名称',
|
|
required: true,
|
|
component: 'Input',
|
|
},
|
|
{
|
|
field: 'status',
|
|
label: '状态',
|
|
component: 'RadioButtonGroup',
|
|
defaultValue: 0,
|
|
componentProps: {
|
|
options: [
|
|
{ label: '启用', value: 0 },
|
|
{ label: '停用', value: 1 },
|
|
],
|
|
},
|
|
},
|
|
],
|
|
showActionButtonGroup: false,
|
|
});
|
|
|
|
async function handleSubmit() {
|
|
const values = await validate();
|
|
console.log(values);
|
|
}
|
|
defineExpose({
|
|
handleSubmit,
|
|
});
|
|
</script>
|