perf: ⚡ 优化地区选择器代码
							parent
							
								
									00a56473f1
								
							
						
					
					
						commit
						7bbb657379
					
				|  | @ -75,13 +75,21 @@ export default { | |||
|           if (res.result.length && val.id !== 0) { | ||||
|             this.chiosend[index] = val | ||||
|           } | ||||
|           else if(!res.result.length){ | ||||
|             this.chiosend[index] = val | ||||
|           } | ||||
|           this.data[level] = res.result; | ||||
|           if (level == 'city') { | ||||
|             this.data.area = [] | ||||
|             this.data.street = [] | ||||
|             this.chiosend.splice(1, 3, "","",""); | ||||
|           } | ||||
|           if (level == 'area') { | ||||
|             this.data.street = [] | ||||
|             this.chiosend.splice(2, 2, "",""); | ||||
|           } | ||||
|           if (level == 'street') { | ||||
|             this.chiosend.splice(3, 1, ""); | ||||
|           } | ||||
|         }); | ||||
|       } | ||||
|  |  | |||
|  | @ -72,16 +72,24 @@ export default { | |||
|       } | ||||
|       else { | ||||
|         API_Setup.getChildRegion(val.id).then((res) => { | ||||
|           if ( val.id !== 0) { | ||||
|           if (res.result.length && val.id !== 0) { | ||||
|             this.chiosend[index] = val | ||||
|           } | ||||
|           else if(!res.result.length){ | ||||
|             this.chiosend[index] = val | ||||
|           } | ||||
|           this.data[level] = res.result; | ||||
|           if (level == 'city') { | ||||
|             this.data.area = [] | ||||
|             this.data.street = [] | ||||
|             this.chiosend.splice(1, 3, "","",""); | ||||
|           } | ||||
|           if (level == 'area') { | ||||
|             this.data.street = [] | ||||
|             this.chiosend.splice(2, 2, "",""); | ||||
|           } | ||||
|           if (level == 'street') { | ||||
|             this.chiosend.splice(3, 1, ""); | ||||
|           } | ||||
|         }); | ||||
|       } | ||||
|  |  | |||
|  | @ -75,13 +75,21 @@ export default { | |||
|           if (res.result.length && val.id !== 0) { | ||||
|             this.chiosend[index] = val | ||||
|           } | ||||
|           else if(!res.result.length){ | ||||
|             this.chiosend[index] = val | ||||
|           } | ||||
|           this.data[level] = res.result; | ||||
|           if (level == 'city') { | ||||
|             this.data.area = [] | ||||
|             this.data.street = [] | ||||
|             this.chiosend.splice(1, 3, "","",""); | ||||
|           } | ||||
|           if (level == 'area') { | ||||
|             this.data.street = [] | ||||
|             this.chiosend.splice(2, 2, "",""); | ||||
|           } | ||||
|           if (level == 'street') { | ||||
|             this.chiosend.splice(3, 1, ""); | ||||
|           } | ||||
|         }); | ||||
|       } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue