feat: 预加载优化、nav-bar 箭头居中优化
This commit is contained in:
@@ -71,7 +71,15 @@ function sortSectionsByTabs(
|
||||
}));
|
||||
}
|
||||
|
||||
let _navigating = false;
|
||||
|
||||
function releaseNavigateLock() {
|
||||
_navigating = false;
|
||||
}
|
||||
|
||||
function navigateByPath(path?: string, fallbackTitle?: string) {
|
||||
if (_navigating) return;
|
||||
|
||||
if (!path) {
|
||||
wx.showToast({
|
||||
title: fallbackTitle ? `${fallbackTitle} 即将上线` : '即将上线',
|
||||
@@ -96,11 +104,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: path }).catch((err) => {
|
||||
console.error('navigateByPath error:', err);
|
||||
_navigating = true;
|
||||
wx.navigateTo({
|
||||
url: path,
|
||||
complete: releaseNavigateLock,
|
||||
fail: (err) => {
|
||||
console.error('navigateByPath error:', err);
|
||||
releaseNavigateLock();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
path="{{item.path}}"
|
||||
data-title="{{item.title}}"
|
||||
data-path="{{item.path}}"
|
||||
bindtap="onTapCard" />
|
||||
bind:cardtap="onTapCard" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user