From cf2da3b2a63840888815c6a81cbd7948faf93533 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期一, 08 六月 2026 17:41:15 +0800
Subject: [PATCH] aaa
---
h5/utils/goodsFilter.js | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/h5/utils/goodsFilter.js b/h5/utils/goodsFilter.js
index 06b59ea..a5d25cd 100644
--- a/h5/utils/goodsFilter.js
+++ b/h5/utils/goodsFilter.js
@@ -6,9 +6,13 @@
if (!keyword) return true
const kw = String(keyword).trim()
if (!kw) return true
- return (item.name && item.name.indexOf(kw) !== -1) ||
- (item.pinyin && item.pinyin.indexOf(kw) !== -1) ||
- (item.shortPinyin && item.shortPinyin.indexOf(kw) !== -1)
+ const kwLower = kw.toLowerCase()
+ const name = item.name != null ? String(item.name).toLowerCase() : ''
+ const pinyin = item.pinyin != null ? String(item.pinyin).toLowerCase() : ''
+ const shortPinyin = item.shortPinyin != null ? String(item.shortPinyin).toLowerCase() : ''
+ return name.includes(kwLower) ||
+ pinyin.includes(kwLower) ||
+ shortPinyin.includes(kwLower)
}
export function filterGoods(allGoods, options = {}) {
--
Gitblit v1.9.3