Fix:5535 【商城小程序】全国特产、文玩艺术板块的省级导航页面搜索栏,在搜索有效名称时提示“未找到该城市,请重新输入城市名称”
(cherry picked from commit 51e9d8b966)
This commit is contained in:
@@ -384,20 +384,17 @@ export default {
|
|||||||
this.mescroll && this.mescroll.triggerDownScroll()
|
this.mescroll && this.mescroll.triggerDownScroll()
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
if(this.keyword === '') return
|
const keyword = (this.keyword || '').trim()
|
||||||
const matchIndex = this.listGroup.findIndex((group, index) => {
|
if (!keyword) return
|
||||||
let result
|
const matchIndex = this.listGroup.findIndex(group => {
|
||||||
group.city.forEach(item => {
|
const cityList = Array.isArray(group.city) ? group.city : []
|
||||||
result = item.cityName.indexOf(this.keyword, 0)
|
return cityList.some(item => item && item.cityName && item.cityName.indexOf(keyword) !== -1)
|
||||||
if (result !== -1) {
|
|
||||||
this.asideTap(index);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (result !== -1) {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
if (matchIndex !== -1) {
|
||||||
|
this.keyword = keyword
|
||||||
|
this.asideTap(matchIndex)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (matchIndex === -1) {
|
if (matchIndex === -1) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '未找到该城市,请重新输入城市名称',
|
title: '未找到该城市,请重新输入城市名称',
|
||||||
|
|||||||
Reference in New Issue
Block a user