@clone-yangson/form-render
v0.9.11-rc.3
Published
通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成
Downloads
6
Maintainers
Readme
此版本说明: 对官方的[email protected]做了修改
修改如下,对onValidate
做了判断,有传入时才执行
// 用户输入都是调用这个函数
const handleChange = (key, val) => {
isUserInput.current = true;
// 开始编辑,节流
setEditing(true);
debouncedSetEditing.callback(false);
onChange(val);
onValidate && typeof onValidate === "function" && onValidate(getValidateList(val, schema));
};
const updateValidation = (outData, outSchema) => {
const _data = outData || data;
const _schema = outSchema || schema;
onValidate && typeof onValidate === "function" && onValidate(getValidateList(_data, _schema));
};
属性onValidate
不默认空函数
function FormRender({
name = '$form',
column = 1,
className,
schema = {},
formData = {},
widgets = {},
FieldUI = DefaultFieldUI,
fields = {},
mapping = {},
showDescIcon = false,
showValidate = true,
displayType = 'column',
onChange = () => {},
onValidate, // 不默认空函数
onMount = () => {},
readOnly = false,
labelWidth = 110,
useLogger = false,
forwardedRef,
}) {