我试图在一个页面上使用多个弹出窗口,但唯一要打开的弹出窗口是数组中的最后一个,无论您悬停在哪个触发元素上。这是使用 Material-UI v1.0.0-beta.46。
class MultiplePopover extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
open: false,
anchorEl: null,
};
this.handlePopoverOpen = this.handlePopoverOpen.bind(this);
this.handlePopoverClose = this.handlePopoverClose.bind(this);
}
handlePopoverOpen(event) {
this.setState({
anchorEl: event.target,
});
}
handlePopoverClose() {
this.setState({
anchorEl: null,
});
}
render() {
const { classes } = this.props;
const { anchorEl } = this.state;
const open = !!anchorEl;
const multi = [
{
_id: 0,
name: 'name1',
hoverText: 'text1',
linkUrl: '#',
},
{
_id: 1,
name: 'name2',
hoverText: …Run Code Online (Sandbox Code Playgroud)