Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert 组件的onClose方法,是否支持阻止默认关闭事件 #19280

Closed
chaserstrong opened this issue Oct 18, 2019 · 1 comment
Closed
Labels

Comments

@chaserstrong
Copy link

The issue which is not created via http://new-issue.ant.design will be closed immediately.


注意:不是用 http://new-issue.ant.design 创建的 issue 会被立即关闭。

我的Alert组件内容比较多,影响了其他div的布局。想要加一个toggle的功能,可以收缩高度。 然后看到有close的功能,感觉正好可以用。 但是我发现在onClose方法里,无法阻止默认的关闭事件。
我看源码里似乎是这样子调用的:

_this.handleClose = function (e) {
            e.preventDefault();
            var dom = ReactDOM.findDOMNode(_this);
            dom.style.height = dom.offsetHeight + 'px';
            // Magic code
            // 重复一次后才能正确设置 height
            dom.style.height = dom.offsetHeight + 'px';
            _this.setState({
                closing: false
            });
            (_this.props.onClose || noop)(e);
        };

请问是否能支持我的需求?

@ant-design-bot
Copy link
Contributor

Hello @chaserstrong, your issue has been closed because it does not conform to our issue requirements. Please use the Issue Helper to create an issue, thank you!

你好 @chaserstrong,为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 issue 助手 来创建 issue 以方便我们定位错误。谢谢配合!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants