<template><div id= "Body" class= "Application" v-show= "show" V-cloak><div class= "Applicationform" > <div class= "essentialinformation" ><ul><li><div class= "Agencynamjian fr" ></div><div class=" Agencyname AgencyJantou "> <span class= "plasecity" v-show= "Plasecityshow" v-text= "Plaseprovincetext" ></span> ;<select v-model= ' provinceselect ' @change = "citychange (1)" ><option v-for= "(Item,index) in Application.province ": key=" index ": value=" Item.id "v-text=" Item.title "></option> </select></div></li><li><div class= "Agencynamjian fr" ></div><div class=" Agencyname AgencyJantou "> <span class= "plasecity" v-show= "Plasecityshow" v-text= "Plasecitytext" ></span><select v-model= "cityselect" @change = "Citychange (2)" > <option v- For= "(Item,index) in the city": key= "index": value= "Item.id" v-text= "Item.title" ></option></select></div></li><li><div class= "Agencynamjian fr" ></div><div class=" Agencyname AgencyJantou noBorder " > <span class= "plasecity" v-show= "Plasecityshow" v-text= "Plasecountytext" ></span><select v-model= "Countyselect" > <option v-for= "(Item,index) in C Ounty ": key=" index ": value=" Item.id "v-text=" Item.title "></option></select></div></li></ul></div></div></div> </template><script> Export Default {name: ' Application ', data () {return {show:false,application: {province: [], City: {}, County: {}},City : [], County: [],Provinceselect: ', Cityselect: ', Countyselect: ', Tishi:false, Tishitxt: ', plase Cityshow:true, Plasecitytext: ' Please select the City ', Plaseprovincetext: ' Please select the City ', Plasecountytext: ' Please select (district) County ' }}, methods: {verify:function () {Let thisobj = "This" $chaos. Settitle (' Registration form ') this . $chaos. Verify (Function () {thisobj. $chaos. Ajax ({data: {pid: ' 0 '}, Slient:true, userinfo:true, url: ' Get_address_by_pid ', callback:function (type, re s) {if (Type!== ' success ') {return} if (Res.status) {thisObj.application.province = res.info.region_list Thisobj.show = true} else {thisobj. $vux. Toast.show ({text: Res.msg, type: ' Text ', Position: ' Bottom '}}} }) thisobj. $chaos. Ajax ({slient:true, userinfo:true, url: ' User_is_si GN ', callback:function (type, res) {if (Type!== ' success ') {return } if (res.status) {Let UserInfo = thisobj. $chaos. GetUserInfo () if (userinfo.u Ser_info.is_sign = = = 1) {window.location.href = ' #/courselist '} else { UserInfo.user_info.is_buy_course = 1 thisobj. $chaos. Setuserinfo (UserInfo)}} else {thisobj. $vux. Toast.show ({text:res.msg, type: ' Text ', Position: ' Bottom'}}}})}, Citychange: function (type) {Let thisobj = this if (type = = = 1) {if (Thisobj.provinceselect = = = ' | | typeo F Thisobj.provinceselect = = = ' undefined ') {return} if (typeof Thisobj.application.city[this Obj.provinceselect] = = = ' undefined ') {thisobj.plasecityshow = False thisobj. $chaos. Ajax ({ Data: {Pid:thisObj.provinceSelect}, Slient:true, Userinfo:t Rue, url: ' Attend/get_address_by_pid ', callback:function (type, res) {if (type !== ' success ') {return} if (Res.status) {Thisobj.application.city[thisobj.provinceselect] = res.info.region_listthisobj.city = res.info.region_list Thisobj.cityselect = thisobj.city[0][' id '} else { Thisobj. $vux. Toast.show ({text:res.msg, type: ' Text ', Position: ' Bottom '}}}})} else {thisobj.city = Thisobj.application.city[thisobj.provinceselect]Thisobj.cityselect = thisobj.city[0][' id '}}} else {if (thisobj.city = = = ' | | typeof thisobj.c ity = = = ' undefined ') {return} else {if (typeof thisobj.application.county[thisobj.city] = = = ' undefined ') {thisobj. $chaos. Ajax ({data: {pid:Thisobj.cityselect}, Slient:true, Userinfo:true, url: ' Attend/get_address_by_pid ', Callback:function (Type, res) {if (Type!== ' success ') {return } if (Res.status) {Thisobj.application.county[thisobj.cityselect] = res.info.region_listThisobj.county = res.info.region_list Thisobj.countyselect = thisobj.county[0][' id '} else {thisobj. $vux. Toast.show ({text:res.msg, type: ' Text ' , Position: ' Bottom ')}}) } else {thisobj.county = Thisobj.application.county[thisobj.cityselect] Thisobj.countyse Lect = thisobj.county[0][' id '] }}}}, Created:function () {this.verify ()}, watch: {' $route ': ' Verify '}}</script><style scoped> [V-cloak] {display:none; }. plasecity{Position:absolute; top:0; left:0; right:0; bottom:0; line-height:55px; text-indent:10px; }. Essentialinformation,. importainformation {background: #FFFFFF; }. essentialinformation {margin:10px 0; }. essentialinformation ul,. importainformation ul {margin:0 15px; }. agencynameimg {width:20px; height:20px; line-height:4.3; }. fl {float:left; }. noborder {border:0; }. Essentialinformation:after {content: '; Display:block; Clear:both; }. Agencynamjian {width:11px; height:8px; line-height:4.3; }. Agencyjantou {padding-right:40px; position:relative; }. agencyname {margin-left:30px; border-bottom:1px solid #cccccc; line-height:3.8}. Essentialinformation input,. essentialinformation Select {width:100%; text-indent:10px; border:0; -webkit-appearance:none; Background:transparent; }. essentialinformation Select {height:55px; position:relative; z-index:0; }. agencybut {margin-top:100px; }. Squadbutton {text-align:center; Color: #fff; Background: #fbac36; Margin:0 30px; line-height:2.5; font-size:16px; box-shadow:0px 1px 5px #ccc; }. agencybut {margin-top:100px; }</style>
The Change event for Vue Select, where the clicked city name exists in the array, the next call does not need to call the interface again