react-selectize如何给出浮选标签文字

时间:2017-12-22 11:24:30

标签: reactjs

在react-selectize下拉列表中没有出现。所以请帮我看看如何显示下拉列表。

var options = ["Idea", "Airtel", "Vodaphone", "Docomo", "Aircel"].map(function(provider){
     return {label: provider, value: provider}
 });
 <SimpleSelect
    options = {options}
  placeholder = "Select a fruit"
 theme = "material" 

  style={{
    'width': '100%',
'marginTop': '10px',
   'fontSize': '16px'
     }}
 />

1 个答案:

答案 0 :(得分:0)

<SimpleSelect placeholder="Select a fruit" onValueChange={value => alert(value)}> <option value = "apple">apple</option> <option value = "mango">mango</option> <option value = "orange">orange</option> <option value = "banana">banana</option> </SimpleSelect> 要求您声明这样的选项(example on the react-selectize github page):

MultiSelect

要将选项作为道具传递,请使用var options = ["Idea", "Airtel", "Vodaphone", "Docomo", "Aircel"].map(function(provider){ return {label: provider, value: provider} }); <MultiSelect options = {options} placeholder = "Select a fruit" theme = "material" style={{ 'width': '100%', 'marginTop': '10px', 'fontSize': '16px' }} />

{{1}}