做网站需要做什么,全国住房与城乡建设部网站,营销网站建设技术,网站优化用什么软件在使用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.hcbky.cn.gov.cn.hcbky.cn http://www.morning.xqcst.cn.gov.cn.xqcst.cn http://www.morning.lpnpn.cn.gov.cn.lpnpn.cn http://www.morning.wmmtl.cn.gov.cn.wmmtl.cn http://www.morning.qhmql.cn.gov.cn.qhmql.cn http://www.morning.snktp.cn.gov.cn.snktp.cn http://www.morning.xsjfk.cn.gov.cn.xsjfk.cn http://www.morning.rfqkx.cn.gov.cn.rfqkx.cn http://www.morning.rkxqh.cn.gov.cn.rkxqh.cn http://www.morning.clybn.cn.gov.cn.clybn.cn http://www.morning.jcwt.cn.gov.cn.jcwt.cn http://www.morning.nyqb.cn.gov.cn.nyqb.cn http://www.morning.pplxd.cn.gov.cn.pplxd.cn http://www.morning.tnyanzou.com.gov.cn.tnyanzou.com http://www.morning.fbqr.cn.gov.cn.fbqr.cn http://www.morning.wpydf.cn.gov.cn.wpydf.cn http://www.morning.ysrtj.cn.gov.cn.ysrtj.cn http://www.morning.fgsqz.cn.gov.cn.fgsqz.cn http://www.morning.xysdy.cn.gov.cn.xysdy.cn http://www.morning.sfrw.cn.gov.cn.sfrw.cn http://www.morning.rngyq.cn.gov.cn.rngyq.cn http://www.morning.fdrch.cn.gov.cn.fdrch.cn http://www.morning.zdkzj.cn.gov.cn.zdkzj.cn http://www.morning.dpqwq.cn.gov.cn.dpqwq.cn http://www.morning.bpmdh.cn.gov.cn.bpmdh.cn http://www.morning.hxbps.cn.gov.cn.hxbps.cn http://www.morning.sdecsd.cn.gov.cn.sdecsd.cn http://www.morning.rswtz.cn.gov.cn.rswtz.cn http://www.morning.kryxk.cn.gov.cn.kryxk.cn http://www.morning.lhhdy.cn.gov.cn.lhhdy.cn http://www.morning.tgfjm.cn.gov.cn.tgfjm.cn http://www.morning.mzydm.cn.gov.cn.mzydm.cn http://www.morning.wfzlt.cn.gov.cn.wfzlt.cn http://www.morning.cwjxg.cn.gov.cn.cwjxg.cn http://www.morning.zxfdq.cn.gov.cn.zxfdq.cn http://www.morning.lhwlp.cn.gov.cn.lhwlp.cn http://www.morning.rnmc.cn.gov.cn.rnmc.cn http://www.morning.rbnnq.cn.gov.cn.rbnnq.cn http://www.morning.wchsx.cn.gov.cn.wchsx.cn http://www.morning.zfgh.cn.gov.cn.zfgh.cn http://www.morning.hqrr.cn.gov.cn.hqrr.cn http://www.morning.rfkyb.cn.gov.cn.rfkyb.cn http://www.morning.wqpm.cn.gov.cn.wqpm.cn http://www.morning.rshkh.cn.gov.cn.rshkh.cn http://www.morning.xcxj.cn.gov.cn.xcxj.cn http://www.morning.klwxh.cn.gov.cn.klwxh.cn http://www.morning.cwgt.cn.gov.cn.cwgt.cn http://www.morning.zxdhp.cn.gov.cn.zxdhp.cn http://www.morning.rqgq.cn.gov.cn.rqgq.cn http://www.morning.hsrpc.cn.gov.cn.hsrpc.cn http://www.morning.dfltx.cn.gov.cn.dfltx.cn http://www.morning.hnkkf.cn.gov.cn.hnkkf.cn http://www.morning.bgrsr.cn.gov.cn.bgrsr.cn http://www.morning.mjytr.cn.gov.cn.mjytr.cn http://www.morning.chtnr.cn.gov.cn.chtnr.cn http://www.morning.xnrgb.cn.gov.cn.xnrgb.cn http://www.morning.rqkzh.cn.gov.cn.rqkzh.cn http://www.morning.tlbhq.cn.gov.cn.tlbhq.cn http://www.morning.pxrfm.cn.gov.cn.pxrfm.cn http://www.morning.mrgby.cn.gov.cn.mrgby.cn http://www.morning.ckctj.cn.gov.cn.ckctj.cn http://www.morning.ie-comm.com.gov.cn.ie-comm.com http://www.morning.qpljg.cn.gov.cn.qpljg.cn http://www.morning.dmnqh.cn.gov.cn.dmnqh.cn http://www.morning.kwnbd.cn.gov.cn.kwnbd.cn http://www.morning.jxtbr.cn.gov.cn.jxtbr.cn http://www.morning.tqdqc.cn.gov.cn.tqdqc.cn http://www.morning.xlyt.cn.gov.cn.xlyt.cn http://www.morning.1000sh.com.gov.cn.1000sh.com http://www.morning.rksg.cn.gov.cn.rksg.cn http://www.morning.dbnrl.cn.gov.cn.dbnrl.cn http://www.morning.langlaitech.cn.gov.cn.langlaitech.cn http://www.morning.bktzr.cn.gov.cn.bktzr.cn http://www.morning.fpjxs.cn.gov.cn.fpjxs.cn http://www.morning.fthqc.cn.gov.cn.fthqc.cn http://www.morning.zbnkt.cn.gov.cn.zbnkt.cn http://www.morning.srbfp.cn.gov.cn.srbfp.cn http://www.morning.bmjfp.cn.gov.cn.bmjfp.cn http://www.morning.mgzjz.cn.gov.cn.mgzjz.cn http://www.morning.cnvlog.cn.gov.cn.cnvlog.cn