Reactjs react jsonschema form extra asynctypeahead,设置初始值
如何在react jsonschema form extra asynctypeahead中从db设置初始值? 我可以在db中保存所选元素的ID,但当我返回带有加载值的表单时,typeahead字段为空 这是我的代码:Reactjs react jsonschema form extra asynctypeahead,设置初始值,reactjs,react-bootstrap-typeahead,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:
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
}
}
有人能帮我吗?你能发布你的React代码吗?这里是完整的代码:无论如何,我们认为方法是在选项中预取数据。