Javascript react-popup中是否有show属性
在react弹出窗口中有一个触发按钮,它是否具有show属性Javascript react-popup中是否有show属性,javascript,reactjs,popup,Javascript,Reactjs,Popup,在react弹出窗口中有一个触发按钮,它是否具有show属性 <Popup trigger={<button> Trigger</button>} position="right center"> <div>Popup content here !!</div> </Popup> 在这里弹出内容!! 我的意思是,我的要求是在事件发生时显示弹出窗口(当我在react表中单击一个单元格时-触发器转到onclick函数,如果
<Popup trigger={<button> Trigger</button>} position="right center">
<div>Popup content here !!</div>
</Popup>
在这里弹出内容!!
我的意思是,我的要求是在事件发生时显示弹出窗口(当我在react表中单击一个单元格时-触发器转到onclick函数,如果我可以在onclick中执行一些操作来触发弹出窗口)
比如:
<Popup show=this.state.showpopup position="right center">
<div>Popup content here !!</div>
</Popup>
在这里弹出内容!!
将从onclick设置this.state.showpopup。弹出窗口有一个名为open的道具,该道具采用布尔值。 尝试:
我想你想在不使用触发道具的情况下显示弹出窗口, 试试这个
函数组件(){
const[showmodel,setshowmodel]=useState(false)
返回(
setShowModal(真)}>触发器
在这里弹出内容!!
)
}
open={this.state.showpopup}
function component() {
const [showModal, setShowModal] = useState(false)
return (
<Fragment>
<button onClick={() => setShowModal(true)}>Trigger</button>
<Popup modal={showModal} position="right center">
<div>Popup content here !!</div>
</Popup>
</Fragment>
)
}