feat: 预加载优化、nav-bar 箭头居中优化

This commit is contained in:
R524809
2026-05-26 11:20:36 +08:00
parent fbdad6e02b
commit 824e83c887
9 changed files with 75 additions and 14 deletions
+22 -3
View File
@@ -19,7 +19,15 @@ const TAB_BAR_PATHS = new Set([
'/pages/profile/profile',
]);
let _navigating = false;
function releaseNavigateLock() {
_navigating = false;
}
function navigateByPath(path?: string, fallbackTitle?: string) {
if (_navigating) return;
const p = String(path || '').trim();
if (!p) {
wx.showToast({
@@ -37,11 +45,22 @@ function navigateByPath(path?: string, fallbackTitle?: string) {
query,
);
}
wx.switchTab({ url: basePath });
_navigating = true;
wx.switchTab({
url: basePath,
complete: releaseNavigateLock,
fail: releaseNavigateLock,
});
return;
}
wx.navigateTo({ url: p }).catch((err) => {
console.error('navigateByPath error:', err);
_navigating = true;
wx.navigateTo({
url: p,
complete: releaseNavigateLock,
fail: (err) => {
console.error('navigateByPath error:', err);
releaseNavigateLock();
},
});
}
+1 -1
View File
@@ -116,7 +116,7 @@
path="{{item.path}}"
data-title="{{item.title}}"
data-path="{{item.path}}"
bindtap="onTapCard"
bind:cardtap="onTapCard"
/>
</view>
</view>