| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <view class="tab-bar">
- <view class="tab-item" @click="onTabClick(0)">
- <uni-icons type="home" size="20" color="#666"></uni-icons>
- <text class="tab-text">慢病首页</text>
- </view>
- <view class="tab-item" @click="onTabClick(1)">
- <uni-icons type="bars" size="20" color="#666"></uni-icons>
- <text class="tab-text">健康数据</text>
- </view>
- <view class="tab-item" @click="onTabClick(2)">
- <uni-icons type="person" size="20" color="#666"></uni-icons>
- <text class="tab-text">个人中心</text>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- const onTabClick = (index: number) => {
- console.log('Tab clicked:', index)
- switch (index) {
- case 0: // 慢病首页
- uni.switchTab({
- url: '/pages/index/index'
- })
- break
- case 1: // 健康数据
- uni.switchTab({
- url: '/pages/health/index'
- })
- break
- case 2: // 个人中心
- uni.switchTab({
- url: '/pages/profile/index'
- })
- break
- }
- }
- </script>
- <style>
- .tab-bar {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- height: 100rpx;
- background-color: #ffffffe7;
- display: flex;
- justify-content: space-around;
- align-items: center;
- border-top: 1rpx solid #eee;
- }
- .tab-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- flex: 1;
- height: 100%;
- }
- .tab-text {
- font-size: 24rpx;
- color: #666;
- }
- </style>
|