Files
airz-uniapp/components/BottomNav.uvue
T

30 lines
2.2 KiB
Plaintext
Raw Normal View History

2026-09-10 10:57:40 +08:00
<template>
<view class="bottom-nav" :style="bottomStyle(14)">
<view class="nav-item" @click="go('/pages/home/home')"><view :class="active == 'home' ? 'nav-icon active-icon' : 'nav-icon'"><AppIcon name="home" :size="54" :muted="active != 'home'" /></view><text :class="active == 'home' ? 'nav-label active-label' : 'nav-label'">首页</text></view>
<view class="nav-item" @click="go('/pages/news/news')"><view :class="active == 'news' ? 'nav-icon active-icon' : 'nav-icon'"><AppIcon name="file-text" :size="54" :muted="active != 'news'" /></view><text :class="active == 'news' ? 'nav-label active-label' : 'nav-label'">新闻</text></view>
<view class="nav-item" @click="go('/pages/messages/messages')"><view :class="active == 'message' ? 'nav-icon active-icon' : 'nav-icon'"><AppIcon name="message" :size="54" :muted="active != 'message'" /></view><text :class="active == 'message' ? 'nav-label active-label' : 'nav-label'">消息</text></view>
<view class="nav-item" @click="go('/pages/profile/profile')"><view :class="active == 'profile' ? 'nav-icon active-icon' : 'nav-icon'"><AppIcon name="user" :size="54" :muted="active != 'profile'" /></view><text :class="active == 'profile' ? 'nav-label active-label' : 'nav-label'">我的</text></view>
2026-09-10 10:57:40 +08:00
</view>
</template>
<script setup lang="uts">
import AppIcon from '@/components/AppIcon.uvue'
import { usePageLayout } from '@/services/layout.uts'
const { bottomStyle } = usePageLayout()
2026-09-10 10:57:40 +08:00
defineProps({ active: { type: String, default: 'home' } })
const go = (url: string) => {
const pages = getCurrentPages()
if (pages.length > 0 && '/' + pages[pages.length - 1].route == url) return
uni.reLaunch({ url: url })
}
2026-09-10 10:57:40 +08:00
</script>
<style>
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; min-height: 130rpx; background-color: #ffffff; border-top: 1rpx solid #e7edf6; flex-direction: row; box-shadow: 0 -6rpx 18rpx rgba(18, 38, 75, 0.04); }
2026-09-10 10:57:40 +08:00
.nav-item { flex: 1; height: 116rpx; align-items: center; justify-content: center; }
.nav-icon { width: 64rpx; height: 60rpx; border-radius: 18rpx; align-items: center; justify-content: center; }
.active-icon { background-color: #edf5ff; }
.nav-label { margin-top: 7rpx; font-size: 24rpx; color: #64748b; }
2026-09-10 10:57:40 +08:00
.active-label { color: #0868f7; font-weight: 700; }
</style>