areaCheck.js 2.4 KB
"use strict";
var utils_addressData = require("../utils/address-data.js");
var common_vendor = require("../common/vendor.js");
const _sfc_main = {
  props: {
    shows: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      columns: [],
      columnData: []
    };
  },
  mounted() {
    this.columns[0] = utils_addressData.localData.map((item) => item.name);
    this.columns[1] = utils_addressData.localData[0].cities.map((item) => item.name);
    this.columns[2] = utils_addressData.localData[0].cities[0].districts.map((item) => item.name);
  },
  methods: {
    close() {
      this.$emit("close", false);
    },
    changeHandler(e) {
      const {
        columnIndex,
        value,
        values,
        index,
        picker = this.$refs.uPicker
      } = e;
      console.log("\u53D8\u5316", index);
      if (columnIndex === 0) {
        let arr = utils_addressData.localData.find((item) => item.name == value[0]);
        let arr1 = arr.cities.map((item) => item.name);
        this.columnData = arr1;
        console.log("\u5E02", arr1[0], arr);
        let distinguish = arr.cities[0].districts.map((item) => item.name);
        picker.setColumnValues(1, arr1);
        picker.setColumnValues(2, distinguish);
      }
      if (columnIndex === 1) {
        let economize = utils_addressData.localData.find((item) => item.name == value[0]);
        let city = economize.cities.find((item) => item.name == value[1]);
        let distinguish = city.districts.map((item) => item.name);
        picker.setColumnValues(2, distinguish);
      }
    },
    confirm(e) {
      this.$emit("popShow", e.value);
    }
  }
};
if (!Array) {
  const _easycom_u_picker2 = common_vendor.resolveComponent("u-picker");
  _easycom_u_picker2();
}
const _easycom_u_picker = () => "../uni_modules/uview-plus/components/u-picker/u-picker.js";
if (!Math) {
  _easycom_u_picker();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return {
    a: common_vendor.sr("uPicker", "700f6895-0"),
    b: common_vendor.o($options.close),
    c: common_vendor.o($options.confirm),
    d: common_vendor.o($options.changeHandler),
    e: common_vendor.p({
      immediateChange: true,
      show: $props.shows,
      columns: $data.columns
    })
  };
}
var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/componets/areaCheck.vue"]]);
wx.createComponent(Component);