【问题标题】:Adding custom success and error messages for the create and edit views为创建和编辑视图添加自定义成功和错误消息
【发布时间】:2020-06-29 18:29:27
【问题描述】:

所以在文档中它说只是在带有 onSuccess / onFailure 函数的编辑组件上添加一个道具,我已经这样做了,但是导航到要编辑的页面会引发如下错误: Warning: Unknown event handler property `onSuccess`. It will be ignored.

代码在这里:

export const AffiliateEdit = (props) => {
  const notify = useNotify();
  const onSuccess = () => {
    notify('Affiliate saved successfully');
  }

  return (
    <Edit {...props} onSuccess={onSuccess}>
      <SimpleForm redirect="list">
        <ColorInput source="color" />
        <TextInput source="name" validate={[required()]} />
        <ReferenceInput
          source="network_id"
          reference="networks"
          validate={[required()]}
        >
          <SelectInput optionText="name" />
        </ReferenceInput>
        <TextInput
          source="reference"
          validate={[required()]}
          helperText="Please use all lower case, no spaces or underscores e.g affiliatename"
        />
      </SimpleForm>
    </Edit>
  )
};

此处的文档参考:https://marmelab.com/react-admin/CreateEdit.html

【问题讨论】:

    标签: react-admin


    【解决方案1】:

    Nvm 搞定了,只需要更新 react-admin 哈哈

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-13
      • 2014-04-01
      • 1970-01-01
      • 2014-05-31
      • 2016-10-14
      • 2013-09-23
      • 2021-10-29
      相关资源
      最近更新 更多