feat: update TopNavBar and shared work page navigation

Add leftAction prop to TopNavBar to support back or home left navigation actions, update left icon accordingly. Add optional chaining to shareDetail.templateName to prevent errors. Modify sharedWork page to use home left action and update back handler to use direct home reLaunch.
This commit is contained in:
duanshuwen
2026-07-16 22:45:15 +08:00
parent cf723e5b93
commit dc12b8ba88
2 changed files with 26 additions and 12 deletions

View File

@@ -1,8 +1,9 @@
<template>
<view class="shared-work-page">
<view class="shared-work-nav">
<TopNavBar :title="shareDetail.templateName || '旅行作品'" background="#fff" title-color="#173a5f"
back-icon-color="#173a5f" :align-with-menu-button="true" :z-index="3" @back="handleBack" />
<TopNavBar :title="shareDetail?.templateName || '旅行作品'" background="#fff" title-color="#173a5f"
back-icon-color="#173a5f" left-action="home" :align-with-menu-button="true" :z-index="3"
@back="openAppHome" />
</view>
<view class="shared-work-scroll">
@@ -106,14 +107,11 @@ const openAigcHome = () => {
});
};
const handleBack = () => {
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack();
return;
}
openAigcHome();
const openAppHome = () => {
uni.reLaunch({
url: "/pages/index/index",
fail: () => showToast("打开首页失败"),
});
};
const handleCreateOwn = async () => {