feat:小程序自定义tabbar

This commit is contained in:
dzc committed 2026-03-13 16:40:18 +08:00
1 parent 4b1e41b550
commit 11fb30e17d
158 files changed
+47290 -27243

No files matched your search

@@ -1,7 +1,9 @@
<script setup>
import { computed } from "vue"
import { router } from "@@/index"
import { useTabbarStore } from "@@/stores/tabbar"
const tabbarStore = useTabbarStore()
const emit = defineEmits(["rightClick"])
const rightMap = {
@@ -35,17 +37,8 @@ const isHistiry = computed(() => {
return router.hasHistory()
})
const isTabbar = computed(() => {
return router.hasTabbar()
})
const isDashboard = computed(() => {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
if (!currentPage) {
return true
}
return currentPage.route != "pages/root/dashboard"
return tabbarStore.currentRoute == "pages/root/dashboard"
})
function doBackClick() {
@@ -60,9 +53,9 @@ function doToDashboard() {
<template>
<view class="navbar" :style="{ backgroundColor: bgColor, height: '44px' }">
<view class="navbar_left">
<view class="sicon-back icon" @tap="doBackClick" />
<view v-if="isDashboard" class="navbar_left_line" />
<view v-if="isDashboard" class="sicon-home icon" @tap="doToDashboard" />
<view v-if="isHistiry" class="sicon-back icon" @tap="doBackClick" />
<view v-if="isHistiry" class="navbar_left_line" />
<view v-if="!isDashboard" class="sicon-home icon" @tap="doToDashboard"></view>
</view>
<view class="navbar_title" :style="{ color: titleColor }">{{ props.title }}</view>
<view v-if="props.rightIcon" class="navbar_right" @tap="emit('rightClick')">