Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/zh-CN/start/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,7 @@ class MyComponent extends React.Component<any, any> {
##### richTextToken: string

内置 rich-text 为 frolaEditor,想要使用,请自行购买,或者用免费的 Tinymce,不设置 token 默认就是 Tinymce。

##### hideValidateFailedDetail: boolean

Form 表单验证失败时在 notify 消息提示中是否隐藏详细信息,默认展示,设置为 true 时隐藏
2 changes: 1 addition & 1 deletion src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class Editor extends React.Component<EditorProps, any> {
height,
translate: __
} = this.props;
let style = this.props.style || {};
let style = {...(this.props.style || {})};

style.width = width;
style.height = height;
Expand Down
7 changes: 5 additions & 2 deletions src/store/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,18 @@ export const FormStore = ServiceStore.named('FormStore')
self.restError.length
) {
let msg = failedMessage ?? self.__('Form.validateFailed');
const env = getEnv(self);
// 同时也列出所有表单项报错,方便在很长的表单中知道是哪个字段的问题
failedMessage ??
// 支持在env中配hideValidateFailedDetail来隐藏所有表单项报错
failedMessage == null &&
!env.hideValidateFailedDetail &&
self.items.forEach(item => {
item.errorData.forEach(errorData => {
msg = `${msg}\n${item.name}: ${errorData.msg}`;
});
});

msg && getEnv(self).notify('error', msg);
msg && env.notify('error', msg);

throw new Error(msg);
}
Expand Down