This time I will bring you a case sharing of mint-ui realizing three-level linkage. What are the precautions for mint-ui to realize three-level linkage. The following is a practical case, let’s take a look. The
project is a mobile project based on vue2 for your reference. The specific content is as follows
1. Actual effect
Address three-level linkage mint-ui picker.png
2. First, you need to download a data containing Chinese provinces, cities, districts and counties
as follows :
(This address contains second-level linkage data, third-level linkage data, fourth-level linkage data, etc., find what you need)
(A better Chinese region data, it is recommended to use this)
3. The specific code
mainly uses the picker component of mint-ui. For the use of mint-ui, please refer to the official website
Ⅰ, html component
<p> <mt-picker></mt-picker> </p><p>地址3级联动:{{myAddressProvince}} {{myAddressCity}} {{myAddresscounty}}</p>
Ⅱ, component method
<script> import { Picker } from 'mint-ui'; import myaddress from '../../../static/address3.json' //引入省市区数据 export default { name: '', components: { 'mt-picker': Picker }, props: {}, data () { return { myAddressSlots: [ { flex: 1, defaultIndex: 1, values: Object.keys(myaddress), //省份数组 className: 'slot1', textAlign: 'center' }, { pider: true, content: '-', className: 'slot2' }, { flex: 1, values: [], className: 'slot3', textAlign: 'center' }, { pider: true, content: '-', className: 'slot4' }, { flex: 1, values: [], className: 'slot5', textAlign: 'center' } ], myAddressProvince:'省', myAddressCity:'市', myAddresscounty:'区/县', } }, created() { }, methods: { onMyAddressChange(picker, values) { if(myaddress[values[0]]){ //这个判断类似于v-if的效果(可以不加,但是vue会报错,很不爽) picker.setSlotValues(1,Object.keys(myaddress[values[0]])); // Object.keys()会返回一个数组,当前省的数组 picker.setSlotValues(2,myaddress[values[0]][values[1]]); // 区/县数据就是一个数组 this.myAddressProvince = values[0]; this.myAddressCity = values[1]; this.myAddresscounty = values[2]; } }, }, mounted(){ this.$nextTick(() => { //vue里面全部加载好了再执行的函数 (类似于setTimeout) this.myAddressSlots[0].defaultIndex = 0 // 这里的值需要和 data里面 defaultIndex 的值不一样才能够初始化 //因为我没有看过源码(我猜测是因为数据没有改变,不会触发更新) }); } } </script>
Refer to the article vue mint-ui to realize the 4-level linkage of provincial and municipal streets (the four-level linkage of mint-ui picker)
I believe I have read it You have mastered the method in the case of this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
What are the uses of swiper in vue
Angular HMR function implementation method (with code)
react native floating button component graphic tutorial
The above is the detailed content of mint-ui realizes three-level linkage case sharing. For more information, please follow other related articles on the PHP Chinese website!

穿越苍茫征途,踏足西游之境!今日,征途IP正式宣布将与央视动画《西游记》展开跨界合作,共同打造一场融合了传统与创新的文化盛宴!此次携手,不仅标志着两大国产经典品牌的深度合作,更彰显了征途系列在弘扬中国传统文化道路上的不懈努力与坚持。征途系列自诞生以来,便凭借其深厚的文化底蕴和多元化的游戏玩法,受到玩家们的喜爱。在文化传承方面,征途系列更是始终保持着对中国传统文化的敬意与热爱,将传统文化元素巧妙地融入游戏,为玩家们带来了更多的乐趣和启发。而央视动画《西游记》则是陪伴了一代又一代人成长的经典之作,其

网易《阴阳师》手游在今日宣布,阴阳师×初音未来限定联动将于3月6日正式开始。联动限定SSR初音未来(CV:藤田咲)、SSR镜音铃·连(CV:下田麻美)即将降临平安京!联动线上特别演出活动3月9日在游戏内正式开启~

经典重聚,逆转时空。《天龙2》手游与经典电影《大话西游》携手定档4月11日!恰逢《天龙2》手游周年庆典,邀请大家共同重温经典回忆,再次见证至尊宝与紫霞至死不渝的传奇故事。七彩祥云要有,金甲圣衣也要有当那句“般若波罗蜜”回荡在耳边时,你是否会想起紫霞留在至尊宝心底的那一滴眼泪?一眼万年,却难逃宿命之劫。纵使万劫不复,吾爱至死不渝。大话西游联动外观【一眼万年】【天意】将随周年庆版本同步上线。愿你可以身披金甲圣衣又或可以邂逅自己的盖世英雄,重回至情至性的青春年少。五百年守护,真爱至死不渝那日偶遇洛阳说

日期,《逆水寒》官宣将于4月19号-5月12号与肯德基展开联动,但联动的具体内容却让很多人蚌埠住了,连番直说“尬上天了”、“要社死了”!原因就出在这次主题活动的口号上,曾经见识过《原神》《崩铁》肯德基联动的小伙伴肯定有印象,什么“异世相遇、尽享美味”,到了《逆水寒》这里就成了:对店员喊出「神候府查案,尔等何人?」店员需回答「炸鸡大业,不容差池!」对员工的培训指南:绝对不能笑!不止这个,这次联动还办起了舞蹈大赛,到主题店做出“闻‘基’起舞”舞蹈动作,还能获得一个摇摇乐小立牌。尬,太尬了!但就是要这

Java开发表单字段的联动与依赖功能引言:在Web开发中,表单是经常使用到的一种交互方式,用户可以通过表单填写信息并提交,而繁琐、冗余的表单字段选择操作往往会给用户带来不便。因此,表单字段的联动和依赖功能被广泛应用于提升用户体验和操作效率。本文将介绍如何使用Java开发实现表单字段的联动和依赖功能,并提供相应的代码示例。一、表单字段联动功能的实现表单

网易游戏在今天宣布,《暗黑破坏神:不朽》决定联动《仙剑奇侠传》。4月24日“一剑逍遥”开启不朽修仙新时代!一个是西方魔幻的经典之作,一个是东方仙侠的永恒回忆,暗黑宇宙与仙剑江湖时空交错,两大IP携手斩妖除魔。4月24日,关于正义与侠道的不灭传说将在庇护之地上演!

元梦之星奥特曼正版联动系列,赛罗泽塔同款时装细节今日大公开,相信大家已经期待很久了,与赛罗泽塔联名时装已于今日上线,一起跟随小编来看看本次奥特曼联动的更多细节,希望能够给你带来帮助。元梦之星奥特曼正版联动:赛罗泽塔共鸣奥特之力,迸发热血火花!赛罗作为光之国新一代的年轻奥特战士终极赛罗警备队的队长赛罗奥特曼不羁又善良,热情又奔放“有我在身边,你还不放心吗?赛罗会尽全力保护星宝星宝们快穿上赛罗奥特曼时装,与赛罗一起奋勇战斗吧!细节展示建模动作展示出场动作待机动作泽塔我才不是三分之一的半吊子,我是宇宙

在数据可视化的领域中,ECharts作为一款被广泛使用的前端图表库,其强大的数据可视化功能受到了各个行业的追捧。在实际项目中,经常会遇到需要对多个图表进行联动展示的情况,本文将介绍如何结合ECharts和PHP接口实现多图表联动的统计图展示,并给出具体的代码示例。一、前置技能在本文的实践中,需要掌握以下技能:HTML、CSS、JavaScript的基础知识;


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version
Visual web development tools
