feat:【框架】form-api 增加 disabled 控制的能力

This commit is contained in:
YunaiV
2025-10-03 20:15:31 +08:00
parent e9fafab07c
commit 95295d5b93

View File

@@ -289,6 +289,18 @@ export class FormApi {
}
}
/**
* 设置表单禁用状态:用于非 Modal 中使用 Form 时,需要 Form 自己控制禁用状态
* @author 芋道源码
* @param disabled 是否禁用
*/
setDisabled(disabled: boolean) {
this.setState((prev) => ({
...prev,
commonConfig: { ...prev.commonConfig, disabled },
}));
}
async setFieldValue(field: string, value: any, shouldValidate?: boolean) {
const form = await this.getForm();
form.setFieldValue(field, value, shouldValidate);