fix: 修复固定分类逻辑以确保正确处理当前索引和项目

- 优化了固定分类的判断逻辑,确保在当前索引为 null 或 undefined 时正确初始化,并在固定分类存在时调用 curseClick 方法。
This commit is contained in:
2026-03-25 17:44:35 +08:00
parent 2fd84c57e0
commit 32c625ab2a

View File

@@ -642,11 +642,16 @@ export default {
//存储的需要固定分类 //存储的需要固定分类
this.fixed = uni.getStorageSync("fixed"); this.fixed = uni.getStorageSync("fixed");
//固定分类 //固定分类
if (this.fixed) { if (this.currentIndex === null || this.currentIndex === undefined) {
this.curseClick(this.currentItem, this.currentIndex);
} else {
this.currentIndex = 0; this.currentIndex = 0;
this.currentItem = null; }
if (
this.fixed &&
this.currentItem &&
this.currentIndex !== null &&
this.currentIndex !== undefined
) {
this.curseClick(this.currentItem, this.currentIndex);
} }
uni.hideTabBar(); uni.hideTabBar();
// #ifdef APP-PLUS // #ifdef APP-PLUS