2017-08-27 141 views

回答

0

答案是調用下拉的參考的選擇(IDX)在你的方法,從插件製造商。可以發現here。 例子: this.refs.dropDown.select(-1)

1

在屬性:

<ModalDropdown options={['option 1', 'option 2']} 
    onSelect={this._dropdown_select} 
    defaultIndex={this.state.selectedIndex} 
> 
    ... 
</ModalDropdown> 

構造函數

constructor(props) { 
    super(props) 
    this.state = {selectedIndex: '', dropDown:{}} 
    this._dropdown_select = this._dropdown_select.bind(this) 
} 

方法:

_dropdown_select(event){ 
    this.setState({selectedIndex: event.target.index, dropDown:event}) 
} 

呼叫選擇方法

this.state.dropDown.select(2) 
+0

如何調用使'下降down'選擇指數從另一種方法中以編程方式,我應該怎麼稱呼呢?我怎樣才能讓'dropdown'選擇一個我選擇的索引? – Asif

+0

剛剛更新了上面的腳本檢查。 –

+0

看一看選擇方法 –

相關問題