zoukankan      html  css  js  c++  java
  • vue 省市区三级联动

    <select class="myCenter_add_row-5" v-model="province" :v-bind="province" @change="citychange($event)">
    <option v-for="i in provincelist" v-bind:value="i.id">{{i.name}}</option>
    </select>
    <select class="myCenter_add_row-5" v-model="city" @change="areachange($event)">
    <option v-for="k in citylist" v-bind:value="k.id">{{k.name}}</option>
    </select>
    <select class="myCenter_add_row-5" v-model="area">
    <option v-for="j in arealist" v-bind:value="j.id">{{j.name}}</option>
    </select>
    <!------------- html、结束------------->
    province: "",
    provincename: "",
    provincelist: [],
    city: "",
    cityname: "",
    citylist: [],
    area: "",
    areaname: "",
    arealist: [],
    <!------------- vue。js声明、结束------------->
    this.$http("/psys-enter/enterpriseBase/selectCityByLevel",{}, 0,1)
    .then(data => {
    this.provincelist=data.data;
    })
    .catch(error => {
     
    });
    <!------------- 一次性请求数据、结束------------->
    citychange: function() {
    let that = this;
    this.provincelist.forEach(function(i) {
    if (i.id == that.province) {
    that.provincename = i.name;
    that.citylist = i.sub;
    that.arealist = [];
    }
    });
    },
    areachange: function() {
    let that = this;
    this.citylist.forEach(function(i) {
    if (i.id == that.city) {
    that.arealist = i.sub;
    that.cityname = i.name;
    }
    });
    },
    this.arealist.forEach(function(i){
    if(that.area==i.id){
    that.areaname=i.name
    }
    })
    <!------------- js、结束------------->
     
  • 相关阅读:
    【hive】null值判断
    【hive】where使用注意的问题
    【hive】关于浮点数比较的问题
    【hive】在alter修改元数据的时候报错 mismatched input 'xxxxx' expecting KW_EXCHANGE
    破解诅咒心法
    泡妞心法
    awk高级
    排除故障的总结
    机房运维相关面试题
    统计流入流出流量
  • 原文地址:https://www.cnblogs.com/CMing/p/9229021.html
Copyright © 2011-2022 走看看