gpt4 book ai didi

javascript - 使用包装但模态未打开

转载 作者:行者123 更新时间:2023-12-03 16:32:26 26 4
gpt4 key购买 nike

import React, { PropTypes } from 'react';
import Dialog from 'material-ui/Dialog';

export default class simpleModal extends React.Component {

constructor(props){
super(props)
}

handlePrimaryButton = () => {
this.props.router.push('/some/path');
}

render(){
return(
<Dialog
actions={<RaisedButton
label="OK"
primary={true}
onTouchTap={this.handlePrimaryButton}
/>}
modal={false}
open={this.props.open}
>
{this.props.msg}
</Dialog>
)
}
}

我使用 material-ui Dialog 组件创建了一个包装器,但无法打开它。在另一个组件中,我的渲染方法中有这个:
<simpleModal open={this.state.openSimpleModal} />
然后我改变了 openSimpleModal 的状态使用 this.setState({openSimpleModal: true})
我没有看到模态打开。我上面的代码中是否缺少任何内容?我设法使用 Dialog material-ui 的组件直接但不带有包装器。

注意:chrome 控制台中根本没有错误。

最佳答案

旧线程,但我在使用包装器时遇到了同样的问题。不得不使用对父级的回调,不漂亮。

material-ui-next 中的 Dialog 组件没有这个问题了。

关于javascript - 使用包装但模态未打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43589054/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com