From 2265d393dc560190aed6f17e4087b17e7505fa2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Mon, 2 Feb 2026 14:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AD=9B=E9=80=89=E6=A1=86?= =?UTF-8?q?=E4=B8=AD=E5=87=BA=E7=8E=B0=E4=B8=A4=E4=B8=AA=E5=9C=9F=E9=B8=A1?= =?UTF-8?q?=E8=9B=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pages/index/index.js b/pages/index/index.js index 4cb118b..28b04de 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1583,8 +1583,14 @@ Page({ const updatedCategories = categories.map(category => { return category === '白壳' ? '土鸡蛋' : category; }); + // 确保"全部"在第一位 + if (!updatedCategories.includes('全部')) { + updatedCategories.unshift('全部'); + } + // 去除重复项 + const uniqueCategories = [...new Set(updatedCategories)]; this.setData({ - categories: updatedCategories + categories: uniqueCategories }); } }).catch(err => {