reactjs - 在笑话酶中按名称查找组成元素
问题描述
零件:
<input name="search" onChange={this.onChange}>
console.log(component.find('div').at(0).childAt(0).find('input').find('search').debug())
错误:
不显示任何东西
解决方案
您可以通过指定称为Object Property Selector的属性来查找组件。请在此处查找详细信息。
正如您所说,您想使用name
属性查找组件,然后请尝试以下操作:
component.find({ name: "search" }).debug();
推荐阅读
- python - Elasticsearch API 未在 URL 中传递 Json 数据集
- mysql - 使用 Docker Compose 在端口 3307 上运行 MySQL
- git - Git:合并文件的合并结果子集
- python - Python/Selenium - 清除我的 chrome webdriver 中的缓存和 cookie?
- android - Android 编程返回按钮
- javascript - 从 php 文件运行 .innerHTML 以更改 HTML 元素
- http - set-cookie 标头未在 Edge 中设置 cookie
- rebol - Red 或 Rebol:如何将“test/a”转换为 [test/a]
- php - node.js 等效于 PHP if-else 显示 html 内容
- java - JLayeredPane 图像未显示