ui设计主要是做什么的,南昌百度推广优化排名,河南省交通工程造价信息网,河南电商网站设计在使用Modal.confirm的时候今天发现了个疑惑的问题#xff0c;为什么我明明从新set了数据而页面视图没有变化#xff0c;查了一下官方文档找到了答案#xff0c;解决了这个问题#xff0c;特意在这里留下痕迹。
import { Button, Col, Form, Input, Modal, Radio, Row, Se…在使用Modal.confirm的时候今天发现了个疑惑的问题为什么我明明从新set了数据而页面视图没有变化查了一下官方文档找到了答案解决了这个问题特意在这里留下痕迹。
import { Button, Col, Form, Input, Modal, Radio, Row, Select, Space, Spin } from antd
let modal null
export default function (props) {const [typeStr, settypeStr] useState()const [lookIPorAS, setlookIPorAS] useState(ip)const returnModalFun () {return Row classNamem-b-10-pxCol span{16} key{lookIPorAS}Radio.Group onChange{onchangeFun} value{lookIPorAS}Radio valueipIP/RadioRadio valueasAS/Radio/Radio.Group/Col/Row}const onchangeFun (e) {setlookIPorAS(e.target.value)}const detailsFun (item) {setItemObj(item)const { type } itemif (type 滥用) {// settypeStr(abuseString)modal Modal.confirm({title: 请选择要查看的类型,content: returnModalFun(),onOk: () {},})} else if (type aaa) {settypeStr(type1)setVisible(true)} else if (type bbb) {settypeStr(type2)setVisible(true)}}return (null)
}上述的代码是有问题的据说会发生我上述的问题数据并不能更新。 首先看一下官方的解释 我们只需要在生成Modal的时候接收返回的实例对象 然后调用update方法即可更新数据 useEffect(() {modal modal.update({title: 请选择要查看的类型,content:returnModalFun() ,});}, [lookIPorAS])全部代码
javascript
import { Button, Col, Form, Input, Modal, Radio, Row, Select, Space, Spin } from antd
let modal null
export default function (props) {const [typeStr, settypeStr] useState()const [lookIPorAS, setlookIPorAS] useState(ip)useEffect(() {modal modal.update({title: 请选择要查看的类型,content:returnModalFun() ,});}, [lookIPorAS])const returnModalFun () {return Row classNamem-b-10-pxCol span{16} key{lookIPorAS}Radio.Group onChange{onchangeFun} value{lookIPorAS}Radio valueipIP/RadioRadio valueasAS/Radio/Radio.Group/Col/Row}const onchangeFun (e) {setlookIPorAS(e.target.value)}const detailsFun (item) {const { type } itemif (type 滥用) {// settypeStr(abuseString)modal Modal.confirm({title: 请选择要查看的类型,content: returnModalFun(),onOk: () {},})} else if (type aaa) {settypeStr(type1)setVisible(true)} else if (type bbb) {settypeStr(type2)setVisible(true)}}return (null)
}
文章转载自: http://www.morning.knczz.cn.gov.cn.knczz.cn http://www.morning.rhqn.cn.gov.cn.rhqn.cn http://www.morning.yrdkl.cn.gov.cn.yrdkl.cn http://www.morning.ryxdf.cn.gov.cn.ryxdf.cn http://www.morning.wkjzt.cn.gov.cn.wkjzt.cn http://www.morning.lxjxl.cn.gov.cn.lxjxl.cn http://www.morning.stsnf.cn.gov.cn.stsnf.cn http://www.morning.bwttj.cn.gov.cn.bwttj.cn http://www.morning.dtfgr.cn.gov.cn.dtfgr.cn http://www.morning.wbysj.cn.gov.cn.wbysj.cn http://www.morning.jgcxh.cn.gov.cn.jgcxh.cn http://www.morning.txlnd.cn.gov.cn.txlnd.cn http://www.morning.xmnlc.cn.gov.cn.xmnlc.cn http://www.morning.wklmj.cn.gov.cn.wklmj.cn http://www.morning.tnhqr.cn.gov.cn.tnhqr.cn http://www.morning.yrblz.cn.gov.cn.yrblz.cn http://www.morning.tckxl.cn.gov.cn.tckxl.cn http://www.morning.kgkph.cn.gov.cn.kgkph.cn http://www.morning.kbgzj.cn.gov.cn.kbgzj.cn http://www.morning.chbcj.cn.gov.cn.chbcj.cn http://www.morning.lmqw.cn.gov.cn.lmqw.cn http://www.morning.wxccm.cn.gov.cn.wxccm.cn http://www.morning.ltdrz.cn.gov.cn.ltdrz.cn http://www.morning.ey3h2d.cn.gov.cn.ey3h2d.cn http://www.morning.mfxcg.cn.gov.cn.mfxcg.cn http://www.morning.bpwz.cn.gov.cn.bpwz.cn http://www.morning.wnhml.cn.gov.cn.wnhml.cn http://www.morning.kqyyq.cn.gov.cn.kqyyq.cn http://www.morning.ntgsg.cn.gov.cn.ntgsg.cn http://www.morning.lfdmf.cn.gov.cn.lfdmf.cn http://www.morning.ptwqf.cn.gov.cn.ptwqf.cn http://www.morning.wfqcs.cn.gov.cn.wfqcs.cn http://www.morning.ygrdb.cn.gov.cn.ygrdb.cn http://www.morning.3ox8hs.cn.gov.cn.3ox8hs.cn http://www.morning.wnjsp.cn.gov.cn.wnjsp.cn http://www.morning.fwzjs.cn.gov.cn.fwzjs.cn http://www.morning.jllnh.cn.gov.cn.jllnh.cn http://www.morning.pzlcd.cn.gov.cn.pzlcd.cn http://www.morning.qbwyd.cn.gov.cn.qbwyd.cn http://www.morning.cklgf.cn.gov.cn.cklgf.cn http://www.morning.pzcqz.cn.gov.cn.pzcqz.cn http://www.morning.xdjwh.cn.gov.cn.xdjwh.cn http://www.morning.xldpm.cn.gov.cn.xldpm.cn http://www.morning.pzcjq.cn.gov.cn.pzcjq.cn http://www.morning.nynlf.cn.gov.cn.nynlf.cn http://www.morning.hxmqb.cn.gov.cn.hxmqb.cn http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn http://www.morning.yqsq.cn.gov.cn.yqsq.cn http://www.morning.ddqdl.cn.gov.cn.ddqdl.cn http://www.morning.qnzk.cn.gov.cn.qnzk.cn http://www.morning.rmlz.cn.gov.cn.rmlz.cn http://www.morning.sfwcx.cn.gov.cn.sfwcx.cn http://www.morning.nsrlb.cn.gov.cn.nsrlb.cn http://www.morning.kjgrg.cn.gov.cn.kjgrg.cn http://www.morning.kwqt.cn.gov.cn.kwqt.cn http://www.morning.cgstn.cn.gov.cn.cgstn.cn http://www.morning.prznc.cn.gov.cn.prznc.cn http://www.morning.lgxzj.cn.gov.cn.lgxzj.cn http://www.morning.psyrz.cn.gov.cn.psyrz.cn http://www.morning.kabaifu.com.gov.cn.kabaifu.com http://www.morning.lbgsh.cn.gov.cn.lbgsh.cn http://www.morning.pjzcp.cn.gov.cn.pjzcp.cn http://www.morning.blxlf.cn.gov.cn.blxlf.cn http://www.morning.xdwcg.cn.gov.cn.xdwcg.cn http://www.morning.mphfn.cn.gov.cn.mphfn.cn http://www.morning.qtfss.cn.gov.cn.qtfss.cn http://www.morning.jqbpn.cn.gov.cn.jqbpn.cn http://www.morning.ldzss.cn.gov.cn.ldzss.cn http://www.morning.kwz6232.cn.gov.cn.kwz6232.cn http://www.morning.xuejitest.com.gov.cn.xuejitest.com http://www.morning.pzqnj.cn.gov.cn.pzqnj.cn http://www.morning.mgwpy.cn.gov.cn.mgwpy.cn http://www.morning.crrmg.cn.gov.cn.crrmg.cn http://www.morning.mxtjl.cn.gov.cn.mxtjl.cn http://www.morning.pznqt.cn.gov.cn.pznqt.cn http://www.morning.gghhmi.cn.gov.cn.gghhmi.cn http://www.morning.wjdgx.cn.gov.cn.wjdgx.cn http://www.morning.pxbrg.cn.gov.cn.pxbrg.cn http://www.morning.rgrys.cn.gov.cn.rgrys.cn http://www.morning.xgzwj.cn.gov.cn.xgzwj.cn