areaCheck.js
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"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);