fooBar.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="uni-tabbar">
  3. <view class="uni-tabbar__item" :class="{'nav-tab-active':home===0}" @click="toIndex(0)">
  4. <view class="uni-tabbar__bd">
  5. <view class="uni-tabbar__icon">
  6. <image :src="home===0?'../../static/img/ceping.png': '../../static/img/index.png'"></image>
  7. </view>
  8. <view class="uni-tabbar__label">
  9. 测评
  10. </view>
  11. </view>
  12. </view>
  13. <view class="uni-tabbar__item" :class="{'nav-tab-active':home===4}" @click="toIndex(4)">
  14. <view class="uni-tabbar__bd">
  15. <view class="uni-tabbar__icon">
  16. <image :src="home===4?'../../static/img/useractive.png': '../../static/img/user.png'"></image>
  17. </view>
  18. <view class="uni-tabbar__label">
  19. 我的
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. components: {},
  28. data() {
  29. return {
  30. home: 0,
  31. }
  32. },
  33. onLoad() {
  34. },
  35. methods: {
  36. toIndex(index) {
  37. this.$emit('toIndex', index)
  38. this.home = index
  39. }
  40. }
  41. }
  42. </script>
  43. <style scoped lang="scss">
  44. $navHeight:54px; //导航栏高度
  45. $navBoxHeight:34px; //导航栏盒子高度,XR系列底部HOME健
  46. .uni-tabbar {
  47. box-sizing: border-box;
  48. position: fixed;
  49. // left: 0;
  50. max-width: $uni-width;
  51. display: flex;
  52. height: 54px;
  53. bottom: 0;
  54. width: 100%;
  55. z-index: 998;
  56. background-color: rgb(255, 255, 255);
  57. padding-bottom: env(safe-area-inset-bottom);
  58. box-shadow: 0rpx 0rpx 8rpx rgba(0, 0, 0, 0.06);
  59. }
  60. .uni-tabbar__item{
  61. display: flex;
  62. justify-content: center;
  63. align-items: center;
  64. flex-direction: column;
  65. flex: 1;
  66. font-size: 0;
  67. text-align: center;
  68. -webkit-tap-highlight-color: rgba(0,0,0,0);
  69. }
  70. .uni-tabbar__bd{
  71. position: relative;
  72. height: 50px;
  73. -webkit-flex-direction: column;
  74. flex-direction: column;
  75. cursor: pointer;
  76. display: -webkit-box;
  77. display: -webkit-flex;
  78. display: flex;
  79. -webkit-box-pack: center;
  80. -webkit-justify-content: center;
  81. justify-content: center;
  82. -webkit-box-align: center;
  83. -webkit-align-items: center;
  84. align-items: center;
  85. -webkit-box-orient: vertical;
  86. -webkit-box-direction: normal;
  87. }
  88. .uni-tabbar__icon{
  89. position: relative;
  90. display: inline-block;
  91. margin-top: 5px;
  92. width: 24px;
  93. height: 24px;
  94. image{
  95. width: 100%;
  96. height: 100%;
  97. }
  98. }
  99. .uni-tabbar__label{
  100. position: relative;
  101. text-align: center;
  102. font-size: 13px;
  103. line-height: 1.8;
  104. }
  105. .uni-tabbar__icon__label{
  106. position: absolute;
  107. text-align: center;
  108. font-size: 13px;
  109. width: 100px;
  110. bottom: 0px;
  111. line-height: 1.8;
  112. }
  113. .uni-tabbar__icon__diff{
  114. position: absolute;
  115. bottom: 10px;
  116. width: 82px;
  117. height: 82px;
  118. }
  119. .nav-tab-active {
  120. // height: 38px;
  121. // width: 38px;
  122. // line-height: 38px;
  123. // position: relative;
  124. // top: -14px;
  125. // left: calc(50% - 19px);
  126. // border-radius: 50%;
  127. // background: $dominantHue;
  128. // box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  129. color: #EFD140;
  130. }
  131. // /*苹果x适配 H5APP*/
  132. // @media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
  133. // .uni-tabbar {
  134. // height: $navHeight + $navBoxHeight;
  135. // }
  136. // }
  137. // /*苹果xs适配 H5APP*/
  138. // @media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) {
  139. // .uni-tabbar {
  140. // height: $navHeight + $navBoxHeight;
  141. // }
  142. // }
  143. // /*苹果xr适配 H5APP*/
  144. // @media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) {
  145. // .uni-tabbar {
  146. // height: $navHeight + $navBoxHeight;
  147. // }
  148. // }
  149. </style>