javascript - antd的popover组件中放了个下拉框,只要点击下拉框,popover自动隐藏,怎么解决?

查看:176
本文介绍了javascript - antd的popover组件中放了个下拉框,只要点击下拉框,popover自动隐藏,怎么解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

popover的显示/隐藏原先是正常的,在popover组件中放置了一个下拉框后,点击下拉框进行选择时,popover自动隐藏,导致无法进行下一步操作。
下面是我的代码:

const content = (
      <div style={{ width: '535px', padding: '20px 0px 0 15px' }}>
        <Form layout="inline">
          <FormItem label="请选择子菜单类型:"style={{ margin: '15px 0' }}>
            {getFieldDecorator('projecttype', {initialValue: '1'})(
              <Select style={{ width: '180px' }}>
                <Option value="1">社区版</Option>
                <Option value="2">工具版</Option>
              </Select>
            )}
          </FormItem>
        </Form>
        {/*确定、取消按钮*/}
        <div style={{ textAlign: 'right' }}>
          <Button type="primary" onClick={ this.handleOk }>确定</Button>
          <Button type="ghost" style={{ margin: '0 10px 0 20px' }} onClick={ () => {this.setState({ visible: false })} }>取消</Button>
        </div>
      </div>
    )
    return(
      <Popover
        content={ content }
        trigger="click"
        visible={this.state.visible}
        onVisibleChange={this.handleVisibleChange}
      >
        <Button type="primary" onClick={this.showPopover}><Icon type="plus-circle-o" />添加子菜单</Button>
      </Popover>
    )
  }

仅仅是在官方例子中加了个下拉框,就出现上述问题,请问要怎么解决

解决方案

github有解决方案
https://github.com/ant-design...

这篇关于javascript - antd的popover组件中放了个下拉框,只要点击下拉框,popover自动隐藏,怎么解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆