我正在使用 Redux 框架为Material UI提供的每个实用程序创建单独的组件。
问题是当我调用 Popover Container 时,它从屏幕的左上角飞出。但是,当使用普通的 React 框架创建相同的弹出窗口时。一切正常。
代码片段:Popover.js
class PopoverTip extends Component {
constructor(props) {
super(props);
}
handleRequestClose = () => {
this.props.togglePopover();
};
render() {
const { isOpen, anchorEl } = this.props;
return (
< div>
{isOpen && < Popover
open={isOpen}
anchorEl={anchorEl}
anchorOrigin={{horizontal: 'left', vertical: 'bottom'}}
targetOrigin={{horizontal: 'left', vertical: 'top'}}
animation={PopoverAnimationVertical}
onRequestClose={this.handleRequestClose}>
< Menu>
< MenuItem primaryText="Refresh" />
< MenuItem primaryText="Help & feedback" />
< MenuItem primaryText="Settings" />
< …
Run Code Online (Sandbox Code Playgroud)Run Code Online (Sandbox Code Playgroud)