antd里的Popover组件,ios上点击遮罩层不能关闭气泡,目前安卓上测试可以,为了兼容ios难道只有手写气泡组件吗...多麻烦啊const Item = Popover.Item;class More extends React.Component { constructor(props) { super(props); this.state = { visible: false, selected: '', }; }; onSelect = (opt) => { this.setState({ visible: false, selected: opt.props.value, }); if (opt.props.value == '') { /// } else if (opt.props.value == '') { /// } }; handleVisibleChange = (visible) => { this.setState({ visible, }); }; render() { let offsetX = -((document.querySelector('body').offsetWidth) * 0.125) + 9; return ( <div> <Popover mask overlayClassName="fortest" overlayStyle={{ color: 'currentColor' }} visible={this.state.visible} className="c-more" overlay={[ (<Item key="4" value="code" icon={<Icon type={require('./image/QrCode1.svg')} size="xs" />} data-seed="logId"> 二维码 </Item>), (<Item key="6" value="quit" icon={<Icon type={require('./image/PullOut1.svg')} size="xs" />}> <span style={{ marginRight: 5 }}>退出</span> </Item>), ]} align={{ overflow: { adjustY: 100, adjustX: 0 }, offset: [offsetX, -180], }} onVisibleChange={this.handleVisibleChange} onSelect={this.onSelect} > <div className="c-more-button" icon={<Icon type={require('./image/more1.svg')} size="md" />} > </div> </Popover> </div> ); }}
添加回答
举报
0/150
提交
取消
