xianniu-ui 0.8.45 → 0.8.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xianniu-ui",
3
- "version": "0.8.45",
3
+ "version": "0.8.47",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -64,6 +64,13 @@ export default {
64
64
  return {};
65
65
  },
66
66
  },
67
+ /**
68
+ * 是否全国
69
+ */
70
+ isAll:{
71
+ type:Boolean,
72
+ default:false
73
+ }
67
74
  },
68
75
  data() {
69
76
  return {
@@ -160,7 +167,14 @@ export default {
160
167
  },
161
168
  // 接口获取城市联动数据
162
169
  fnGetCitys() {
163
- const _citys = this.$utils.deepClone(citys);
170
+ const cityArr = citys;
171
+ if(this.isAll){
172
+ cityArr.unshift({
173
+ cityName: '全国',
174
+ cityCode: '000000'
175
+ })
176
+ }
177
+ const _citys = this.$utils.deepClone(cityArr);
164
178
  this.cityList = this.toTreeDataLevel(_citys);
165
179
  this.flattenResult = this.flattenTreeData(
166
180
  this.addParentKey(this.cityList)
@@ -277,11 +291,14 @@ export default {
277
291
  if (!val) return;
278
292
  val = val.replace(/[^\u4e00-\u9fa5]/g, "");
279
293
  const cityArr = val.match(this.$reg.getCity) || [];
294
+ console.log("🚀 ~ str2Code ~ this.$reg.getCity:", this.$reg.getCity)
295
+ console.log("🚀 ~ str2Code ~ cityArr:", cityArr)
280
296
  const newarr =
281
297
  cityArr.length &&
282
298
  cityArr.map((item, idx, arr) => {
283
- return ZXCITY.includes(item) && idx === 0 ? [item, ...arr] : arr;
299
+ return ZXCITY.includes(item) && idx === 0 && arr.length == 2 ? [item, ...arr] : arr;
284
300
  })[0];
301
+ console.log(newarr)
285
302
  const arr = this.getCity(this.cityList, newarr);
286
303
  const res = this.getRes(arr);
287
304
  return { ...res };