Browse Source

修复筛选框中出现两个土鸡蛋的问题

蛋吧eggbar
徐飞洋 1 month ago
parent
commit
2265d393dc
  1. 8
      pages/index/index.js

8
pages/index/index.js

@ -1583,8 +1583,14 @@ Page({
const updatedCategories = categories.map(category => { const updatedCategories = categories.map(category => {
return category === '白壳' ? '土鸡蛋' : category; return category === '白壳' ? '土鸡蛋' : category;
}); });
// 确保"全部"在第一位
if (!updatedCategories.includes('全部')) {
updatedCategories.unshift('全部');
}
// 去除重复项
const uniqueCategories = [...new Set(updatedCategories)];
this.setData({ this.setData({
categories: updatedCategories categories: uniqueCategories
}); });
} }
}).catch(err => { }).catch(err => {

Loading…
Cancel
Save