From 01c400bb7ebfb9b0b3a7f9aefde9c8afc825459e Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Tue, 21 Jul 2026 17:14:13 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A5535=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E5=85=A8=E5=9B=BD=E7=89=B9?= =?UTF-8?q?=E4=BA=A7=E3=80=81=E6=96=87=E7=8E=A9=E8=89=BA=E6=9C=AF=E6=9D=BF?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E7=9C=81=E7=BA=A7=E5=AF=BC=E8=88=AA=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=90=9C=E7=B4=A2=E6=A0=8F=EF=BC=8C=E5=9C=A8=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=9C=89=E6=95=88=E5=90=8D=E7=A7=B0=E6=97=B6=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E2=80=9C=E6=9C=AA=E6=89=BE=E5=88=B0=E8=AF=A5=E5=9F=8E?= =?UTF-8?q?=E5=B8=82=EF=BC=8C=E8=AF=B7=E9=87=8D=E6=96=B0=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E5=9F=8E=E5=B8=82=E5=90=8D=E7=A7=B0=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 51e9d8b9663d709ac28f829248f8f22e892ba625) --- pages/chose-city/chose-city.vue | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pages/chose-city/chose-city.vue b/pages/chose-city/chose-city.vue index 189d361..3e80905 100644 --- a/pages/chose-city/chose-city.vue +++ b/pages/chose-city/chose-city.vue @@ -384,20 +384,17 @@ export default { this.mescroll && this.mescroll.triggerDownScroll() }, search() { - if(this.keyword === '') return - const matchIndex = this.listGroup.findIndex((group, index) => { - let result - group.city.forEach(item => { - result = item.cityName.indexOf(this.keyword, 0) - if (result !== -1) { - this.asideTap(index); - return null; - } - }) - if (result !== -1) { - return result - } + const keyword = (this.keyword || '').trim() + if (!keyword) return + const matchIndex = this.listGroup.findIndex(group => { + const cityList = Array.isArray(group.city) ? group.city : [] + return cityList.some(item => item && item.cityName && item.cityName.indexOf(keyword) !== -1) }) + if (matchIndex !== -1) { + this.keyword = keyword + this.asideTap(matchIndex) + return + } if (matchIndex === -1) { uni.showToast({ title: '未找到该城市,请重新输入城市名称',