office-ui-fabric - 在办公室 ui 结构中,如何在按钮单击时获得默认选定值
问题描述
在我的应用程序中,我使用了 office ui fabric react 下拉控件,当我单击按钮时,我需要检查它是否为空?
public options = [
{ key: 'Employee Name', text: 'Employee Name' },
{ key: 'Employee ID', text: 'Employee ID' },
{ key: 'Department', text: 'Department' }
];
<Dropdown defaultSelectedKey="Employee Name" options={this.options} onChange={this._onChange} />
<input type="button" value="Get Data" id="btnSub" onClick={() => this.readItem()} />
private readItem(): void {
what I need to do here
}
解决方案
从事件目标中读取值。
(e) => this.readItem(e.value.target)
推荐阅读
- function - powershell 在脚本函数中使用 where-object 不起作用
- azure-devops - 您可以在多阶段 devops 管道的条件语句中使用构建标签吗
- python - Altair 中的对数滑块
- r - RStudio 不会在新机器上渲染 Plotly 绘图
- python - 我如何从这个网站上抓取一个随机生成的句子
- python - Python 和 Scrapy - Scraper 不返回结果
- php - ServiceProvider 已注册但在控制器中不起作用
- c++ - 如何为基于范围的 for 重载 std::list 的取消引用运算符?
- google-cloud-platform - artman googleapis google Healthcare api 和 google 的 grpc fhir repo 无法生成客户端?
- excel - 下载带有主题的 Outlook 附件