Skip to content
On this page

YXCascader地址选择器

地址选择器通过取值的数组找到完整地址对象

html
<el-cascader :options="tag.regions" v-model="tag.regionFromVal" disabled
    filterable v-on:change="regionValFromChange()"></el-cascader>
js
methods: {
  init() {
    $.getJSON("../cons/region.json", function (result) {
      app.tag.regions = result || [];
    });
  },
  regionValFromChange() {
    this.tag.regionFromValObj = YX.Cascader.getObj(app.tag.regionFromVal, app.tag.regions);
  }
}
data() {
  return {
    tag: {
      regions: [],  // 省市区全部数据
      regionFromVal: [],  // v-model绑定的值
      regionFromValObj: [], // 处理完的数据
    }
  }
}
mounted() {
  this.init()
}

Released under the MIT License.