xph-form
Version:
This is a configurable form component that supports React
20 lines (19 loc) • 959 B
TypeScript
import { IFormProps, IFormActionType, IRegister, TFormItemProps } from "../types";
/**
* 注意:
* useWatch会监听整个表单值得变化,导致重新渲染formItem,所以要根据实际情况来判断到底是否需要监听表单得值,
* 何时需要监听:只有使用model的formItem属性才需要监听,即当show、ifShow、required、disabled、componentProps、render有其中之一为函数时才需要监听
* 所以当没有使用model的表单项尽量使用值写法,使用函数写法对表单性能开销很大
*/
export declare const useFormModel: (formProps: IFormProps, itemProps: TFormItemProps) => {
rewritingModel: any;
isusewatch: boolean;
};
/**
*
* @description 用于注册form的方法
* form组件会先于parent组件挂载,挂载完后调用register方法,将methods注册到useForm中给parent使用
*
*/
declare const useForm: () => [IRegister, IFormActionType];
export default useForm;