我正在尝试使用material-ui-icon-picker
的反应图标选择器但是,我得到赋予未声明的变量showPickedIcon 错误
edit( { attributes, className, focus, setAttributes, setFocus, setState } ) {
const { content, alignment ,applyStyles,icon} = attributes;
showPickedIcon = (icon) => {
console.info(icon) // prints {name: "access_alarm", code: "e190"}
}
return (
<MaterialUiIconPicker onPick={this.showPickedIcon} />
);
},
我找不到如何解决这个问题。
答案 0 :(得分:0)
未声明showPickedIcon,因此请给它一个声明,如下所示:
edit( { attributes, className, focus, setAttributes, setFocus, setState } ) {
const { content, alignment ,applyStyles,icon} = attributes;
const showPickedIcon = (icon) => {
console.info(icon) // prints {name: "access_alarm", code: "e190"}
}
return (
<MaterialUiIconPicker onPick={this.showPickedIcon} />
);
},