在框外单击时我的框会关闭,这使我丢失了所有输入。我希望我的框仅在单击取消按钮时关闭。我不确定是什么让它在外面点击时关闭。有什么帮助吗?
我正在使用@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>
);
}
Run Code Online (Sandbox Code Playgroud)