react-jsonschema-form-extra asynctypeahead,设置初始值

时间:2019-12-09 14:02:38

标签: reactjs react-bootstrap-typeahead

如何在react-jsonschema-form-extra asynctypeahead中从db设置初始值? 我可以保存在db中选择的元素的ID,但是当我返回带有已加载值的表单时,typeahead字段为空。

这是我的代码:

  user: {
    "ui:field": "asyncTypeahead",
    asyncTypeahead: {
      url: "https://jsonplaceholder.typicode.com/users",
      minLength: 1,
      //selected: {'username':'Bret'},
      selected: {'name':'Leanne Graham'},
      mapping: 'id',
      selectHintOnEnter: true,
      //labelKey: "username",
      labelKey: (option) => `${option.name} ${option.username}`,
      //overrideOptions: true
    }
  }

有人可以帮助我吗?

0 个答案:

没有答案