From 668ff750b2e821be60267ae6face9b264964c24b Mon Sep 17 00:00:00 2001
From: feige996 <1020102647@qq.com>
Date: Sat, 21 Jun 2025 19:22:12 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=84=E7=90=86=E6=88=90=20sar-ui=20?=
=?UTF-8?q?=E7=9A=84tabbar=E5=BD=A2=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/fg-navbar/fg-navbar.vue | 58 --------------------------
src/layouts/fg-tabbar/fg-tabbar.vue | 35 +++++++++-------
src/layouts/tabbar.vue | 13 +-----
3 files changed, 22 insertions(+), 84 deletions(-)
delete mode 100644 src/components/fg-navbar/fg-navbar.vue
diff --git a/src/components/fg-navbar/fg-navbar.vue b/src/components/fg-navbar/fg-navbar.vue
deleted file mode 100644
index dbde618..0000000
--- a/src/components/fg-navbar/fg-navbar.vue
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/layouts/fg-tabbar/fg-tabbar.vue b/src/layouts/fg-tabbar/fg-tabbar.vue
index 0079c25..556e481 100644
--- a/src/layouts/fg-tabbar/fg-tabbar.vue
+++ b/src/layouts/fg-tabbar/fg-tabbar.vue
@@ -3,12 +3,13 @@ import { tabbarStore } from './tabbar'
// 'i-carbon-code',
import { tabbarList as _tabBarList, cacheTabbarEnable, selectedTabbarStrategy } from './tabbarList'
+// @ts-expect-error 预料中的判断
const customTabbarEnable = selectedTabbarStrategy === 1 || selectedTabbarStrategy === 2
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
const tabbarList = _tabBarList.map(item => ({ ...item, path: `/${item.pagePath}` }))
-function selectTabBar({ value: index }: { value: number }) {
- const url = tabbarList[index].path
- tabbarStore.setCurIdx(index)
+function selectTabBar(name: number) {
+ const url = tabbarList[name].path
+ tabbarStore.setCurIdx(name)
if (cacheTabbarEnable) {
uni.switchTab({ url })
}
@@ -18,6 +19,7 @@ function selectTabBar({ value: index }: { value: number }) {
}
onLoad(() => {
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
+ // @ts-expect-error 预料中的判断
const hideRedundantTabbarEnable = selectedTabbarStrategy === 1
hideRedundantTabbarEnable
&& uni.hideTabBar({
@@ -32,23 +34,26 @@ onLoad(() => {
-
-
-
{
:class="[item.icon, idx === tabbarStore.curIdx ? 'is-active' : 'is-inactive']"
/>
-
-
+
+
-
+
-
+
diff --git a/src/layouts/tabbar.vue b/src/layouts/tabbar.vue
index 0c1bb1c..e61c476 100644
--- a/src/layouts/tabbar.vue
+++ b/src/layouts/tabbar.vue
@@ -1,19 +1,10 @@
-
+
-
-
-
+