choices.js仅返回精确的最后选择的项目

时间:2019-04-15 10:17:36

标签: javascript preact

我正在使用choices.js from this package,除了返回的值之外,其他一切都正常运行。这是我的代码

import Choices from 'choices.js';

import '../../../../node_modules/choices.js/public/assets/styles/choices.min.css'
class ProductIngredient extends Component {
    componentDidMount(){
    var multipleCancelButton = new Choices('#choices-multiple-remove-button', {
      removeItemButton: true,
    });
  }
    render(){
        return (
            <label for="choices-multiple-remove-button">With remove button</label>
            <select class="form-control" name="choices-multiple-remove-button" id="choices-multiple-remove-button" placeholder="This is a placeholder" multiple>
            <option value="Choice 1" selected>Choice 1</option>
            <option value="Choice 2">Choice 2</option>
            <option value="Choice 3">Choice 3</option>
            <option value="Choice 4">Choice 4</option>
            </select>
        )
    }
}

我该怎么办?

0 个答案:

没有答案