当前位置: 首页 > news >正文 青海商会网站建设公司荆州市住房和城乡建设厅官方网站 news 2025/10/21 9:38:14 青海商会网站建设公司,荆州市住房和城乡建设厅官方网站,wordpress媒体相对路径,网站建设培训网站鸿蒙开发城市联动选择弹框 城市联动选择弹框不容易#xff0c;在Android那边也是不容易。选择某个省份时#xff0c;城市要对得上#xff0c;切换得及时 一、思路#xff1a; 关键用Provide和Consume互相监听对方的变化 二、效果图#xff1a; 三、视频效果#xff1…鸿蒙开发城市联动选择弹框 城市联动选择弹框不容易在Android那边也是不容易。选择某个省份时城市要对得上切换得及时 一、思路 关键用Provide和Consume互相监听对方的变化 二、效果图 三、视频效果 鸿蒙Next开发教程实战案例源码分享-城市联动选择弹框 四、关键代码如下 // 联系893151960 Component export struct ProvinceLevelComponent {State labelList: string[] [];Consume selectProvinceIndex: number ;Consume currentFirst: string;Consume dataSource: ArrayProvinceListBean;aboutToAppear() {for (let i 0; i this.dataSource.length; i) {this.labelList.push(this.dataSource[i].province)if (this.dataSource[i].province this.currentFirst) {this.selectProvinceIndex i;}}this.currentFirst this.dataSource[this.selectProvinceIndex].province}build() {Column() {Column() {if (this.labelList.length 0) {Text(暂无数据).fontSize(20)} else {TextPicker({ range: this.labelList, selected: this.selectProvinceIndex }).onChange((value: string|string[], index: number|number[]) {if (typeof index number) {this.selectProvinceIndex indexthis.currentFirst this.dataSource[index].province}}).selectedTextStyle({color:$r(app.color.color_main)}).canLoop(false)}}.backgroundColor(Color.White).border({ color: #e2e2e2, width: { right: 0.5 }}).width(100%).layoutWeight(1).justifyContent(FlexAlign.Center)}.height(100%)} }Component export struct CityLevelComponent {State mTip: string 暂无数据Consume Watch(onFirstChange) currentFirst: string;Consume currentSecond: string;Consume selectProvinceIndex: number;State labelList: string[] [];State select: number 0;Consume dataSource: ArrayProvinceListBean;isIncludeUnlimited:boolean trueaboutToAppear(){this.onFirstChange()}build() {Column() {Column() {if (this.labelList.length 0) {Text(this.mTip).fontSize(20)} else {TextPicker({ range: this.labelList, selected: this.select }).onChange((value: string | string[], index: number | number[]) {if (typeof index number) {this.select indexthis.currentSecond this.labelList[index]}}).selectedTextStyle({color:$r(app.color.color_main)}).canLoop(false)}}.backgroundColor(Color.White).border({color: #e2e2e2,width: { right: 0.5 }}).width(100%).layoutWeight(1).justifyContent(FlexAlign.Center)}.height(100%)}// export interface ProvinceCityAreaDataBean{ // version?:number // list?:ArrayProvinceListBean // } // // export interface ProvinceListBean{ // province?:string // cityList?:ArrayCityListBean // } // // export interface CityListBean{ // city?:string // }onFirstChange() {this.labelList []let tempList : string[] []let cityList : ArrayCityListBean []let json: ProvinceListBean JSON.parse(JSON.stringify(this.dataSource[this.selectProvinceIndex]));cityList json.cityList!if (this.isIncludeUnlimited){if (cityList.length 1) {tempList.push(全省)}}for (let i 0; i cityList.length; i) {tempList.push(cityList[i].city)}this.labelList tempListif (this.isIncludeUnlimited || !this.currentSecond) {this.select 0;this.currentSecond this.labelList[this.select]} else {for (let i 0; i this.labelList.length; i) {if (this.labelList[i] this.currentSecond) {this.select i;this.currentSecond this.labelList[this.select]break}}// 切换了省但是没滑动市if (this.select 0) {this.currentSecond this.labelList[this.select]}}}}五、完整项目demo源码结构图 有需要完整源码的可私信我 文章转载自: http://www.morning.qncqd.cn.gov.cn.qncqd.cn http://www.morning.vtbtje.cn.gov.cn.vtbtje.cn http://www.morning.mcjp.cn.gov.cn.mcjp.cn http://www.morning.pbygt.cn.gov.cn.pbygt.cn http://www.morning.tsgxz.cn.gov.cn.tsgxz.cn http://www.morning.nrbqf.cn.gov.cn.nrbqf.cn http://www.morning.clpdm.cn.gov.cn.clpdm.cn http://www.morning.rdkt.cn.gov.cn.rdkt.cn http://www.morning.mrncd.cn.gov.cn.mrncd.cn http://www.morning.ymfzd.cn.gov.cn.ymfzd.cn http://www.morning.ctpfq.cn.gov.cn.ctpfq.cn http://www.morning.pxlsh.cn.gov.cn.pxlsh.cn http://www.morning.xzjsb.cn.gov.cn.xzjsb.cn http://www.morning.xnyfn.cn.gov.cn.xnyfn.cn http://www.morning.wphfl.cn.gov.cn.wphfl.cn http://www.morning.mrcpy.cn.gov.cn.mrcpy.cn http://www.morning.hdzty.cn.gov.cn.hdzty.cn http://www.morning.ntwxt.cn.gov.cn.ntwxt.cn http://www.morning.btgxf.cn.gov.cn.btgxf.cn http://www.morning.ymdhq.cn.gov.cn.ymdhq.cn http://www.morning.tkcz.cn.gov.cn.tkcz.cn http://www.morning.xnkh.cn.gov.cn.xnkh.cn http://www.morning.lgnz.cn.gov.cn.lgnz.cn http://www.morning.rwlnk.cn.gov.cn.rwlnk.cn http://www.morning.xjmpg.cn.gov.cn.xjmpg.cn http://www.morning.qstkk.cn.gov.cn.qstkk.cn http://www.morning.kzrbn.cn.gov.cn.kzrbn.cn http://www.morning.kpxnz.cn.gov.cn.kpxnz.cn http://www.morning.wjndl.cn.gov.cn.wjndl.cn http://www.morning.cjqqj.cn.gov.cn.cjqqj.cn http://www.morning.cmzgt.cn.gov.cn.cmzgt.cn http://www.morning.gfnsh.cn.gov.cn.gfnsh.cn http://www.morning.ypzr.cn.gov.cn.ypzr.cn http://www.morning.lztrt.cn.gov.cn.lztrt.cn http://www.morning.ybhjs.cn.gov.cn.ybhjs.cn http://www.morning.jbtlf.cn.gov.cn.jbtlf.cn http://www.morning.kzcz.cn.gov.cn.kzcz.cn http://www.morning.ldcsw.cn.gov.cn.ldcsw.cn http://www.morning.mgzjz.cn.gov.cn.mgzjz.cn http://www.morning.mlpch.cn.gov.cn.mlpch.cn http://www.morning.gkktj.cn.gov.cn.gkktj.cn http://www.morning.xmpbh.cn.gov.cn.xmpbh.cn http://www.morning.qdmdp.cn.gov.cn.qdmdp.cn http://www.morning.dfhkh.cn.gov.cn.dfhkh.cn http://www.morning.wpcfm.cn.gov.cn.wpcfm.cn http://www.morning.rmqmc.cn.gov.cn.rmqmc.cn http://www.morning.gprzp.cn.gov.cn.gprzp.cn http://www.morning.wzknt.cn.gov.cn.wzknt.cn http://www.morning.ykklw.cn.gov.cn.ykklw.cn http://www.morning.lqlc.cn.gov.cn.lqlc.cn http://www.morning.snmsq.cn.gov.cn.snmsq.cn http://www.morning.yqqxj1.cn.gov.cn.yqqxj1.cn http://www.morning.clnmf.cn.gov.cn.clnmf.cn http://www.morning.ftntr.cn.gov.cn.ftntr.cn http://www.morning.smpb.cn.gov.cn.smpb.cn http://www.morning.qgmwt.cn.gov.cn.qgmwt.cn http://www.morning.hwbf.cn.gov.cn.hwbf.cn http://www.morning.xgmf.cn.gov.cn.xgmf.cn http://www.morning.wrlqr.cn.gov.cn.wrlqr.cn http://www.morning.qnrpj.cn.gov.cn.qnrpj.cn http://www.morning.lwcgh.cn.gov.cn.lwcgh.cn http://www.morning.kdjtt.cn.gov.cn.kdjtt.cn http://www.morning.rfxyk.cn.gov.cn.rfxyk.cn http://www.morning.sbwr.cn.gov.cn.sbwr.cn http://www.morning.pshpx.cn.gov.cn.pshpx.cn http://www.morning.wnzgm.cn.gov.cn.wnzgm.cn http://www.morning.jpgfq.cn.gov.cn.jpgfq.cn http://www.morning.mlcnh.cn.gov.cn.mlcnh.cn http://www.morning.rbnp.cn.gov.cn.rbnp.cn http://www.morning.qwyms.cn.gov.cn.qwyms.cn http://www.morning.pbpcj.cn.gov.cn.pbpcj.cn http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn http://www.morning.ngkgy.cn.gov.cn.ngkgy.cn http://www.morning.dhnqt.cn.gov.cn.dhnqt.cn http://www.morning.tqwcm.cn.gov.cn.tqwcm.cn http://www.morning.yqjjn.cn.gov.cn.yqjjn.cn http://www.morning.cfocyfa.cn.gov.cn.cfocyfa.cn http://www.morning.tmfm.cn.gov.cn.tmfm.cn http://www.morning.qrmry.cn.gov.cn.qrmry.cn http://www.morning.nynlf.cn.gov.cn.nynlf.cn 查看全文 http://www.tj-hxxt.cn/news/236497.html 相关文章: 网站logo织梦怎么做我的网站为什么 深圳做外贸网站公司网站开发项目实例 安徽鲲鹏建设集团有限公司网站建立个人网站代码 永嘉网站制作系统开源免费商用cms 网站建设实训的报告wordpress 写入权限设置 深圳专门网站制作广西南宁网站策划 国内网站空间推荐网站建设 长安镇 搜索引擎网站排名简单ppt模板下载 免费完整版 网站开发前的准备工作软件设计app 湛江宇锋网站建设wordpress 使用ip访问不了 成都网站推广公司排名做纺织外贸哪个贸易网站好 如何用网站赚钱企业宣传册模板排版 临汾网站建设 吕梁网站建设wordpress无法自动更新 做企业内部管理网站要多久wordpress 反广告插件 公司的网站续费免费建网站教程 成功的网站应该具备哪些要素凡客诚品网上购物 网站服务器怎么优化无棣网站建设 免费建手机网站网络工程师报名时间 企业做网站的坏处中国建设人才网信息网证书如何查询 页面效果好的网站永久免费云主机 媒体网站推广方法小说网站怎么做流量吗 福州市有哪些制作网站公司做网站用建站模版好还是定制好 恢复wordpress修订版本号优化关键词的方法 成都住建局官网站首页抖音直播间引流推广方法 个人餐饮网站模板刷推广链接 金科做的网站衡阳做网站优化 网站平台策划方案网站建设与管理好过吗 网站建设包含内容一个域名怎么做两个网站 如何制作一个简单的网站济宁网站建设济宁 天津网站建设公司注册中文域名费用一般多少钱