Fix:5535 【商城小程序】全国特产、文玩艺术板块的省级导航页面搜索栏,在搜索有效名称时提示“未找到该城市,请重新输入城市名称”

This commit is contained in:
linxi
2026-07-21 17:14:13 +08:00
parent 50363edc6e
commit 51e9d8b966
+10 -13
View File
@@ -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: '未找到该城市,请重新输入城市名称',