reactjs - 如何在下拉菜单中添加按钮?
问题描述
我加入了一个正在进行的反应项目以进入案例研究。我们将语义 UI 用于表单和表单下拉列表。我想要做的是在下拉菜单中添加一个按钮,该按钮将启动另一个菜单。
我不确定在哪里添加按钮的代码,或者是否有可能。这是下拉列表的当前代码:
<h1 className="ui centered">Select Engagement Details</h1>
<Form.Group widths="equal">
<Form.Dropdown
fluid
selection
placeholder="Client Name"
onChange={(e, { value }) => {
this.props.handleDropdown({
input: "clientName",
value: value,
optionType: "clientOptions",
options: this.state.clients
});
}}
defaultValue={values.clientName}
options={this.state.clients}
/>
<Form.Dropdown
fluid
selection
placeholder="Engagement Name"
onChange={(e, { value }) => {
this.props.handleDropdown({
value: value,
input: "engagementName",
optionType: "engagementNameOptions",
options: this.state.engagements
});
}}
defaultValue={values.engagementName}
options={this.state.engagements}
/>
</Form.Group>
<Button disabled={!isEnabled} onClick={this.saveAndContinue}>
{" "}
Continue
</Button>
{/* starts new engagement area */}
<hr style={{marginTop: '30px'}}/>
<h2 className="ui centered"> New Engagement </h2>
<Form.Group controlId="newEngagementGroup" widths="equal">
{/* type is not required. Type is useful for common types like "email" or "password" */}
<Form.Input
type="clientName"
placeholder="Enter Client Name"
ref="newClient"
onChange={(e, { value }) => {
this.props.handleDropdown({
input: "newEngagementClientName",
value: value
})
}}
defaultValue={values.newClientName}
/>
<Form.Input
type="engagementType"
placeholder="Enter Engagement Type"
ref="newEngagementType"
onChange={(e, { value }) => {
this.props.handleDropdown({
input: "newEngagementType",
value: value
})
}}
defaultValue={values.newEngagementType} />
</Form.Group>```
解决方案
这是可能的:
有你的按钮到你的选项列表
options={[{ key: "ux", text: (<Button>your button</Button>), value: "ux" }]}
推荐阅读
- python - 重新组合 Panda 中所有重复值的总和
- c# - 将参数传递给转换器
- c# - 在 C# 中使用并行处理来测试站点抵御 DDOS 的能力
- java - Java ArrayList 不同的对象相互扩展,如何知道我检索到的对象?
- css - 如何在 Squarespace Henson 模板的一页上反转徽标 .PNG 和社交图标?
- discord.js - Discord.js:未定义 MessageAttachment
- python - Python get_cmd_output 中的 JumpSSh
- go - 使用 Go 依赖项的修改版本的问题
- javascript - 我想做一个月份名称显示器
- docker - 构建 Docker Image 并使用 github 标记名称对其进行标记