首页 > 解决方案 > 更改值在反应管理员

问题描述

目前我决定将 react-admin 用于一个项目,优秀的 Web 框架,在我的情况下,问题是我无法在我的特定情况下更改任何输入的值和 .

在引用autocompletearrayinput的文档中,我无法澄清我的疑问

谷歌给了我线索,但没有一个对我有用,例如最直观的value={textValue}

选项1:

<ReferenceArrayInput 
  /**... */
  value={textValue}
  /**... */
  >
  <AutocompleteArrayInput optionText={"product_name"} />
</ReferenceArrayInput>;

选项 2:这有效,但仅在第一次加载时不允许再次进行更改。

<ReferenceArrayInput
  /**... */
  defaultValue={textValue}
  /**... */
>
  <AutocompleteArrayInput optionText={"product_name"} />
</ReferenceArrayInput>;

最后是这个:

选项 3:

<ReferenceArrayInput 
  /**... */
  input={{value: textValue}}
  /**... */
>
  <AutocompleteArrayInput optionText={"product_name"} />
</ReferenceArrayInput>;

有人请告诉我一些方法。谢谢。

标签: reactjsmaterial-uireact-admin

解决方案


推荐阅读