merchant.uvue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view class="page">
  3. <view class="content">当前页面:{{ currentTabName }}</view>
  4. <!-- 自定义底部导航 -->
  5. <CustomBottomNav
  6. :current-index="currentTab"
  7. @change="onTabChange"
  8. />
  9. </view>
  10. </template>
  11. <script setup lang="ts">
  12. import { ref, computed } from 'vue';
  13. import CustomBottomNav from '@/components/CustomBottomNav.uvue';
  14. // 当前选中索引
  15. const currentTab = ref(3);
  16. // 根据索引获取名称(用于演示)
  17. const tabNames = ['小丁', '理疗', '预约', '商户', '我的'];
  18. const currentTabName = computed(() => tabNames[currentTab.value]);
  19. // 切换 Tab
  20. const onTabChange = (index: number) => {
  21. currentTab.value = index;
  22. // 可选:跳转到对应 tabBar 页面
  23. const pages = [
  24. '/pages/index/index',
  25. '/pages/index/therapy',
  26. '/pages/index/order',
  27. '/pages/index/merchant',
  28. '/pages/index/my'
  29. ];
  30. uni.switchTab({ url: pages[index] });
  31. };
  32. </script>
  33. <style scoped>
  34. .page {
  35. min-height: 100vh;
  36. padding-bottom: 100rpx; /* 防止内容被遮挡 */
  37. background-color: #f8f8f8;
  38. padding: 20rpx;
  39. }
  40. .content {
  41. font-size: 32rpx;
  42. color: #333;
  43. }
  44. </style>