use-plus-drawer
v1.0.8
Published
高级抽屉表单
Downloads
6
Readme
use-plus-drawer
install
cnpm i use-plus-drawer --save
高级抽屉组件
import type { AddFormProps, AddFormOkParams } from './components/AddForm';
import AddForm, { getParamDatas } from './components/AddForm';
import usePlusDrawer from 'use-plus-drawer';
const addDrawerRef = usePlusDrawer<AddFormProps, AddFormOkParams>(<AddForm screenItem={screenItem} />, {
title: (props) => `在“${props?.screenItem?.name}”下,新增指标`,
onOk: async ({ form: newForm, jsonResultStruct }) => {
const info = await newForm.validateFields();
const payloadItem = getParamDatas({
payload: info,
})
if (TOOLS.dict.get.getVDictTypeByK('INDICATOR_SOURCE_TYPE', `${payloadItem?.sourceType}`) !== '填报') {
payloadItem.jsonResultStruct = jsonResultStruct
}
console.log('新增', info);
const response = await addIndicator({ payload: payloadItem });
if (response) {
form.submit();
return;
}
return false;
},
});
global.less 添加样式文件
@import '~antd/es/drawer/style/index.less';
1.0.5
footer 以及 extra 中 okParams 参数首次未获取到 bug 处理
1.0.7
去除 lodash 等,优化包大小
1.0.8
onClose 方法修改 onClose 改为 async 函数,根据返回值判断抽屉是否关闭,接收 okParams 参数同提交方法参数