【发布时间】:2019-12-11 05:55:26
【问题描述】:
在框外单击时我的框关闭,使我丢失所有输入。 我希望我的盒子只有在点击取消按钮时才关闭。 我不确定是什么使它在外面点击时关闭。有什么帮助吗?
我正在使用@material-ui/core
_close() {
DeviceCreationActions.close();
}
render() {
const actions = [
<Button
id="device-create-dialog-close"
key="device-create-dialog-close"
onClick={this._close}
>
{this.context.intl.formatMessage({id: 'Cancel'})}
</Button>
];
if (0 < this.state.stepIndex) {
actions.push(<Button
id="device-create-dialog-back"
key="device-create-dialog-back"
onClick={this._previousStep.bind(this)}
>
{this.context.intl.formatMessage({id: 'Back'})}
</Button>
);
}
if (
(1 >= this.state.stepIndex && 0 < this.state['formStep' + this.state.stepIndex].length) ||
(0 < this.state.stepIndex)
) {
actions.push(<Button
id="device-create-dialog-next"
key="device-create-dialog-next"
onClick={2 === this.state.stepIndex ? this._save.bind(this) : this._nextStep.bind(this)}
>
{this.context.intl.formatMessage({id: 2 === this.state.stepIndex ? 'Create' : 'Next'})}
</Button>
);
}
【问题讨论】:
-
可以分享Box中的代码吗?还是涉及更多代码?
标签: javascript reactjs dialog modal-dialog material-ui