我正在使用扩展 react-multiselect-dropdown,并在此处使用“基本用法”中的确切代码:https://srigar.github.io/multiselect-react-dropdown/.
options: [{ name: 'Option 1'; id: 1 }, { name: 'Option 2'; id: 2 }];
private renderHeader() {
return (
<div class={CSS.header}>
<div class={CSS.headerHigh}>
<div class={CSS.headerGauche}>
<div class={CSS.categs}>
<Multiselect
options={this.options}
onSelect={this.onSelect}
onRemove={this.onRemove}
displayValue="name"
/>
</div>
</div>
</div>
</div>
);
}
onSelect(selectedList: any, selectedItem: any) {
console.log(selectedList);
}
onRemove(selectedList: any, removedItem: any) {
console.log(selectedList);
}
该元素将显示在我的组件的渲染中,就像任何其他按钮或输入元素一样。
但是对于这个,我收到错误“这是未定义的”,位于我组件的道具构造函数中。
constructor(props?: FiltreDispoWrapperProperties) {
super(props);
}
有人能指出我这里的问题吗?谢谢