2
我在使用react-bootstrap-typeahead
項目中的AsyncTypeahead
時出現問題,看起來好像我的onSearch
處理程序未被調用。我可以在頁面上看到類型提示,但是當我鍵入它時,handleSearch
未被執行,並且我沒有看到任何控制檯日誌記錄。這裏有一個簡單的例子:從react-bootstrap-typeahead包使用AsyncTypeahead問題
import React, {PropTypes, Component} from 'react';
import AsyncTypeahead from 'react-bootstrap-typeahead';
class CustomTypeahead extends Component {
state = { results: [] }
handleSearch(event) {
console.log("Show me what you got")
// fetch data here and set state to results in a promise
// this.setState(results)
}
render() {
return (
<div>
<AsyncTypeahead
onSearch={this.handleSearch.bind(this)}
options={this.state.results}/>
</div>
)
}
}
任何建議或見解真的很感激!
這結束了與我使用與該版本的一個問題我正在閱讀的文檔!總是檢查版本.... – daschi