普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.4 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="tabbar-box">
  3. <view class="tabbar">
  4. <view
  5. :class="{ 'tabbar-active' : select == item.key}"
  6. v-for="(item, index) in list" :key="index"
  7. @click="toPath(item, index)" class="tabbar-item"
  8. >
  9. <view class="tabbar-icon">
  10. <image :src="select == item.key ?
  11. item.selectedIconPath :
  12. item.iconPath" class="tabbar-icon-image" mode="aspectFill"></image>
  13. </view>
  14. <view class="tabbar-title">
  15. {{ item.title }}
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: "tabbar",
  24. props: ['select'],
  25. data() {
  26. return {
  27. list: [
  28. {
  29. "selectedIconPath": "/static/image/tabbar/home-active.png",
  30. "iconPath": "/static/image/tabbar/home.png",
  31. "pagePath": "/pages/index/index",
  32. "title": "首页",
  33. key: 'home',
  34. },
  35. {
  36. "selectedIconPath": "/static/image/tabbar/report-active.png",
  37. "iconPath": "/static/image/tabbar/report.png",
  38. "pagePath": "/pages/index/report",
  39. "title": "报告",
  40. key: 'report',
  41. },
  42. {
  43. "selectedIconPath": "/static/image/tabbar/product-active.png",
  44. "iconPath": "/static/image/tabbar/product.png",
  45. "pagePath": "/pages/index/product",
  46. "title": "产品",
  47. key: 'product',
  48. },
  49. ]
  50. };
  51. },
  52. methods: {
  53. toPath(item, index) {
  54. if (item.key == this.select) {
  55. return
  56. }
  57. uni.reLaunch({
  58. url: item.pagePath
  59. })
  60. },
  61. }
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .tabbar-box {
  66. height: $tabbar-height;
  67. padding-bottom: env(safe-area-inset-bottom);
  68. .tabbar {
  69. position: fixed;
  70. width: 750rpx;
  71. background-color: #fff;
  72. display: flex;
  73. justify-content: center;
  74. align-items: center;
  75. flex-direction: row;
  76. height: $tabbar-height;
  77. padding-bottom: env(safe-area-inset-bottom);
  78. z-index: 999999;
  79. bottom: 0;
  80. left: 0;
  81. color: #BCBCBC;
  82. .tabbar-item {
  83. flex: 1;
  84. display: flex;
  85. flex-direction: column;
  86. justify-content: center;
  87. align-items: center;
  88. .tabbar-icon {
  89. width: 54rpx;
  90. height: 54rpx;
  91. .tabbar-icon-image {
  92. width: 54rpx;
  93. height: 54rpx;
  94. }
  95. }
  96. .tabbar-title {
  97. overflow: hidden;
  98. white-space: nowrap;
  99. text-overflow: ellipsis;
  100. -o-text-overflow: ellipsis;
  101. font-size: 23rpx;
  102. line-height: 35rpx;
  103. }
  104. }
  105. .tabbar-active {
  106. color: $uni-color !important;
  107. }
  108. }
  109. }
  110. </style>