【发布时间】:2020-04-01 19:07:35
【问题描述】:
这是我的Codesandbox
现在,当用户使用 e.target.textContent 在 selectList(antd 组件) 上选择一个项目时,我会更改标题。
有什么方法可以显示所有值,现在我只能显示一个选择列表值。
我想要这样的东西:value from first dropdown / value from second dropdown
<DropDown>
<DropDown.DropDownTitle>
This title will update after user selection // this should be updated when user select
</DropDown.DropDownTitle>
<DropDown.DropDownBody>
<Select
defaultValue="lucy"
style={{ width: 120 }}
onChange={handleChange}
>
<Option value="jack">another</Option>
<Option value="lucy">another 2</Option>
</Select>
<Select
defaultValue="lucy"
style={{ width: 120 }}
onChange={handleChange}
>
<Option value="jack">another 3</Option>
<Option value="lucy">another 4</Option>
</Select>
</DropDown.DropDownBody>
</DropDown>
【问题讨论】:
-
你在哪里存储标题值?
-
@JMadelaine 在上下文 DropDownContext.js