From 767ecb197b70b56985a2dacec946f9679fcb45d2 Mon Sep 17 00:00:00 2001 From: duanshuwen Date: Fri, 17 Jul 2026 08:48:07 +0800 Subject: [PATCH] refactor: simplify TopNavBar and update sharedWork back handling remove leftAction prop and hardcode left icon type in TopNavBar move home navigation logic out of TopNavBar to parent components update sharedWork.vue to use new TopNavBar API and implement proper back handling --- src/components/TopNavBar/index.vue | 25 +++--------------------- src/pages-aigc/sharedWork/sharedWork.vue | 25 ++++++++++++------------ 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/src/components/TopNavBar/index.vue b/src/components/TopNavBar/index.vue index 004c42e..fda14c4 100644 --- a/src/components/TopNavBar/index.vue +++ b/src/components/TopNavBar/index.vue @@ -4,13 +4,10 @@ - - + + - + @@ -53,12 +50,6 @@ const props = defineProps({ type: Boolean, default: true, }, - // 左侧按钮行为 - leftAction: { - type: String, - default: "back", - validator: (value) => ["back", "home"].includes(value), - }, // 背景颜色 background: { type: String, @@ -154,8 +145,6 @@ const navContentStyle = computed(() => { }; }); -const leftIconType = computed(() => (props.leftAction === "home" ? "home-filled" : "left")); - const hasBackListener = computed(() => { const vnodeProps = instance?.vnode?.props || {}; return Boolean(vnodeProps.onBack); @@ -167,14 +156,6 @@ const handleBack = () => { emit("back"); return; } - - if (props.leftAction === "home") { - uni.reLaunch({ - url: "/pages/index/index", - }); - return; - } - // 如果没有监听back事件,默认执行返回上一页 uni.navigateBack({ delta: 1, diff --git a/src/pages-aigc/sharedWork/sharedWork.vue b/src/pages-aigc/sharedWork/sharedWork.vue index ebec826..c496d4b 100644 --- a/src/pages-aigc/sharedWork/sharedWork.vue +++ b/src/pages-aigc/sharedWork/sharedWork.vue @@ -1,17 +1,15 @@