【问题标题】:Autocompletearrayinput TypeError: Polyglot.transformPhrase expects argument #1 to be stringAutocompletearrayinput TypeError: Polyglot.transformPhrase 期望参数 #1 为字符串
【发布时间】:2021-11-18 17:20:42
【问题描述】:

你好堆栈溢出我想知道是否可以在渲染时预先填充默认值。使用 from react admin 时我也遇到错误。这是我的使用方法。

return (
    <Edit {...props}>
      <SimpleForm>
        <TextInput source="audience_name" />
        <ReferenceInput label="entity_ids" source="entity_ids" reference="posts">
          <EntityInput setEntityLabel={onChangeLabel} onSelectEntity={addEntity} entityNames={entityNames} />
        </ReferenceInput>
        <br />
        <AutocompleteArrayInput
          source="tags"
          shouldRenderSuggestions={(val) => {
            console.log(val);
            return val.trim().length > 0;
          }}
          choices={[
            { id: 'programming', name: 'Programming' },
            { id: 'lifestyle', name: 'Lifestyle' },
            { id: 'photography', name: 'Photography' },
          ]}
        />
      </SimpleForm>
    </Edit>
  );
};

【问题讨论】:

    标签: react-admin


    【解决方案1】:

    尝试添加道具translateChoice={false},比如:

    <AutocompleteInput source="first_name" choices={choices} translateChoice={false}/>
    

    【讨论】:

      猜你喜欢
      • 2016-05-09
      • 1970-01-01
      • 2012-12-08
      • 2016-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-17
      • 1970-01-01
      相关资源
      最近更新 更多