lyuis 7 bulan lalu
induk
melakukan
43d4396d7f
2 mengubah file dengan 17 tambahan dan 12 penghapusan
  1. 12 9
      components/hg-level4-address/hgLevel4Address.vue
  2. 5 3
      package/screen/city.vue

+ 12 - 9
components/hg-level4-address/hgLevel4Address.vue

@@ -47,6 +47,10 @@
 			county: {
 				type: [String, Number],
 				default: ''
+			},
+			street: {
+				type: [String, Number],
+				default: ''
 			}
 		},
 		data() {
@@ -104,19 +108,18 @@
 
 				for (const province of this.addressData) {
 					for (const city of province.children || []) {
-						if (city.code == this.city || city.name.indexOf(this.city) !== -1) {
+						if (this.city!=''&&(city.code == this.city || city.name.indexOf(this.city) !== -1)) {
 							this.selectedProvince = province
 							this.selectedCity = city
-							
 							for (const area of city.children || []) {
-								if (area.code == this.county || area.name.indexOf(this.county) !== -1) {
+								if (this.county!=''&&(area.code == this.county || area.name.indexOf(this.county) !== -1)) {
 									this.selectedArea=area
 								}
-							}
-	
-							this.selectedStreet = {
-								code: 'all',
-								name: '全部'
+								for (const street of area.children || []) {
+									if (this.street!=''&&(street.code == this.street || street.name.indexOf(this.street) !== -1)) {
+										this.selectedStreet=street
+									}
+								}
 							}
 							return
 						}
@@ -160,7 +163,7 @@
 
 			/** 街道选择 */
 			selectStreet(street) {
-				return this.$queue.showToast('街道选择暂未开放')
+				return this.$queue.showToast('街道选择暂未开放')
 				this.selectedStreet = street
 			},
 

+ 5 - 3
package/screen/city.vue

@@ -12,7 +12,7 @@
 			</view>
 		</view>
 		 <view class="content">
-			<hg-level4-address :city="city" :county="county"
+			<hg-level4-address :city="city" :county="county" :street="street"
 			  placeholder="请选择地址"
 			  @confirm="onAddressConfirm"
 			  >         
@@ -32,14 +32,16 @@
 				statusBarHeight: 0, // 状态栏高度
 				city: '', //市
 				county: '', //区
+				street:''//街道
 			};
 		},
 		onLoad(options) {
 			// 获取状态栏高度
 			let systemInfo = uni.getSystemInfoSync();
 			this.statusBarHeight = systemInfo.statusBarHeight || 0;
-			this.city = options&&options.city
-			this.county = options&&options.county
+			this.city = options&&options.city||''
+			this.county = options&&options.county||''
+			this.street = options&&options.street||''
 		},
 		onShow() {