【问题标题】:React-admin components on Dashboard?仪表板上的 React-admin 组件?
【发布时间】:2019-01-26 06:12:37
【问题描述】:

当我尝试在我的仪表板组件上使用 react-admin 组件和这段代码时(我假设这些是唯一相关的行):

import { ReferenceInput, AutocompleteInput } from "react-admin";

<ReferenceInput source="id" reference="buildings">
  <AutocompleteInput source="ProjectName" />
</ReferenceInput>

我收到以下错误: “错误:字段必须在用 reduxForm() 修饰的组件内”

我真的很想在我的仪表板上使用 AutocompleteInput - 这可能吗?我假设我必须将 Dashboard 连接到 react-admin 的 redux 存储,并且可能会做一些其他的魔法来实现这一点。

【问题讨论】:

标签: react-admin


【解决方案1】:

所有 react-admin 组件都连接到 redux-form,因此错误可能来自仪表板不是 redux-form。您是否尝试过在 redux-form Field 组件中使用它?

import { ReferenceInput, AutocompleteInput } from "react-admin";
import { Field } from 'redux-form';

    <Field 
       {...this.props} 
       component={ReferenceInput} 
       source="id" 
       reference="buildings"
    >
      <AutocompleteInput source="ProjectName" />
    </Field>

【讨论】:

    猜你喜欢
    • 2019-02-28
    • 1970-01-01
    • 2021-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多