UNPKG

@antdp/antdp-ui

Version:

基于antd封装的组件

27 lines 715 B
import { HOOK_MARK } from 'rc-field-form/lib/FieldContext'; import { InternalFormInstance, InternalNamePath, FormInstance, } from 'rc-field-form/lib/interface'; // 根据 Form.useForm() 返回值 [from] 进行获取子项中更新值的方法 export const getChildItemFun = (form: FormInstance) => { let childFun: any = {}; if (form) { const { getInternalHooks } = form as InternalFormInstance; childFun = getInternalHooks(HOOK_MARK); } const updateValue = (namePath: InternalNamePath, value: any) => { if (childFun.dispatch) { childFun.dispatch({ type: 'updateValue', namePath, value, }); } }; return { ...childFun, updateValue, }; };