<select v-model= "Citys" name= "cityval" @change = "Schoolname (citys)" >
<option v-for= "(Item,index) in the city": value= "Item.val" v-text= "Item.name" ></option>
</select>
<select v-model= "Schools" name= "Schoolval" >
<option v-for= "(Item,index) in school": value= "Item.val" v-text= "Item.name" ></option>
</select>
<script>varVue =NewVue ({el:'#body', Data:function () {return{city: [{val:'0', Name:'City'}], Citys:0, School: [{val:'0', Name:'University'}], schools:0, Schoolajax:"'}}, Methods: {cityname:function () {varThis_obj = This; $.ajax ({type:"Post", url: $app+"/clan/city", DataType:"JSON", Success:function (res) {if(res.status) {$.each (res.info,function (k, v) {this_obj.cit Y.push ({name:v.ar_name, val:v.ar_id, }) }) } Else{}}, Error:function () { $.alert ({msg:'Transmission Error 1' }) } }); }, Schoolname:function (citys) {varThis_obj = This; var data = {Ar_id:citys}; $.ajax ({type:"Post", Data:data, url: $app+"/clan/school", DataType:"JSON", Success:function (res) {This_obj.school=[{Val:'0', Name:'University'}] if(res.status) {$.each (res.info,function (k, v) {This_obj.sch Ool.push ({ val:v.sc_id, name:v.sc_name }) }); This_obj.schools = This_obj.schoolajax; } Else{}, Error:function () {$.A Lert ({msg:'Transmission ERROR 7' }) } }); }, Defules:function () {varThis_obj = This; $.ajax ({type:"Post", url: $app+"/call/team_user", DataType:"JSON", Success:function (res) {console.log (res.info); if(res.status) { this_obj.schoolname (res.info.us_arid ); This_obj.schoolajax = Res.info.us_scid; } Else{}}, Error:function () {$.aler T ({msg:'Transmission Error 5' }) } }); }}) Vue.cityname (); Vue. Defules ();
Vue.js with Select to achieve province, city, after submission, default display province, city information