第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

在外部單擊時(shí)實(shí)現(xiàn)模態(tài)關(guān)閉

在外部單擊時(shí)實(shí)現(xiàn)模態(tài)關(guān)閉

胡說叔叔 2021-06-10 05:01:02
我一直在嘗試在我的系統(tǒng)中實(shí)現(xiàn)一個(gè) onclick 模式關(guān)閉。我已經(jīng)使用關(guān)閉按鈕實(shí)現(xiàn)了一個(gè)模態(tài) onclick 事件,但是在模態(tài)外部單擊時(shí)沒有成功我已經(jīng)嘗試在 div 上添加 onclick 偵聽器,但即使在模態(tài)窗口內(nèi)單擊,內(nèi)容也會關(guān)閉。<div                className={"Overlay " + (this.state.hidden? "hidden": "show")}                id={this.props.id + "-container"} onClick={() => {                this.setState({ hidden: true })            }}>到目前為止,這是我的模態(tài)框渲染代碼 render() {        const contentClassName = this.getContentClassName();        if (this.props.show) {            document.body.style.overflow = 'hidden';        }        const contentStyle = {            width: this.props.width,            height: this.props.height,            position: "relative"        };        return (            <div                className={"Overlay " + (this.state.hidden? "hidden": "show")}                id={this.props.id + "-container"} onClick={() => {                this.setState({ hidden: true })            }}>                <div className={contentClassName}>                    <div className={"Overlay-container"} style={contentStyle}>                        <a id={this.props.id + '-closeButton'}                           className="Overlay-closeBtn icon-close-zoom" onClick={() => {                               this.setState({ hidden: true })                        }}/>                        {this.props.children}                    </div>                </div>            </div>        );    }正如預(yù)期的那樣,我希望在模態(tài)窗口外單擊時(shí)關(guān)閉模態(tài)。目前,即使在單擊模態(tài)窗口后它也會關(guān)閉。
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 209 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號