react-bootstrap-multiselect无法正常工作

时间:2019-06-03 09:40:00

标签: reactjs

import React from 'react';
import Multiselect from 'react-bootstrap-multiselect';

class Test2 extends React.Component {
  constructor(props){
    super(props)
    this.state = {
      list: [{value:'One',selected:true},{value:'Two'},{value:'Three'},{value:'Four',label:'Four Label'}]
    }
  }


  render(){
    return (
        <Multiselect data={this.state.list} multiple />
    );
  }
}

export default Test2;

我在这里使用react-bootstrap-multiselect

用户界面无法正常显示。

我想念什么吗?

请看看。

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试删除标签属性,

import React from 'react';
import Multiselect from 'react-bootstrap-multiselect';

class Test2 extends React.Component {
  constructor(props){
    super(props)
    this.state = {
      list: [{value:'One',selected:true},{value:'Two'},{value:'Three'},{value:'Four'}]
    }
  }


  render(){
    return (
        <Multiselect data={this.state.list} multiple />
    );
  }
}

export default Test2;