酷炫直播运营系统小程序版本

tabbar.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view :class="['tabbar-box',isIpx?'ipx_button':'']">
  3. <view class="tabbar-container">
  4. <view v-for="(item,index) in list" :key='item.pagePath' @click="changeTab(item)">
  5. <view class="image_box">
  6. <image class="tabbar-image" :src="selected===item.pagePath?item.selectedIconPath:item.iconPath" lazy-load="false"> </image>
  7. </view>
  8. <text :style="'color: '+selected === item.pagePath ? selectedColor : color">{{item.text}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name:"tabbar",
  16. props:{
  17. selected: {
  18. type: String,
  19. default: 'homePage'
  20. },
  21. },
  22. data() {
  23. return {
  24. isIpx:false,
  25. color: "#A0A0A0",
  26. selectedColor: "#2662FF",
  27. list: [
  28. {
  29. "path": "/pages/index/index",
  30. "pagePath": "homePage",
  31. "text": "首页",
  32. "iconPath": "/static/tabBar/home.png",
  33. "selectedIconPath": "/static/tabBar/home_yes.png"
  34. },
  35. {
  36. "pagePath":"dateplanPage",
  37. "path": "/pages/dateplan/index",
  38. "text": "直播计划",
  39. "iconPath": "/static/tabBar/sphRank.png",
  40. "selectedIconPath": "/static/tabBar/sphRank_yes.png"
  41. },
  42. {
  43. "path":"/pages/brand/brand",
  44. "pagePath": "brandPage",
  45. "text": "品牌",
  46. "iconPath": "/static/tabBar/live.png",
  47. "selectedIconPath": "/static/tabBar/live.png"
  48. },
  49. {
  50. "path":"/pages/goods/goods",
  51. "pagePath": "goodsPage",
  52. "text": "商品",
  53. "iconPath": "/static/tabBar/cyRank.png",
  54. "selectedIconPath": "/static/tabBar/cyRank_yes.png"
  55. },
  56. {
  57. "path":"/pages/mine/mine",
  58. "pagePath": "minePage",
  59. "text": "我的",
  60. "iconPath": "/static/tabBar/wode.png",
  61. "selectedIconPath": "/static/tabBar/wode_yes.png"
  62. }
  63. ]
  64. };
  65. },
  66. mounted() {
  67. this.isIpx = this.$store.state.systemInfo.isIpx
  68. },
  69. methods: {
  70. changeTab(item){
  71. uni.switchTab({
  72. url:item.path
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style>
  79. .tabbar-box{
  80. position: fixed;
  81. bottom: 0;
  82. width: 100%;
  83. height: 110rpx;
  84. background-color: #fff;
  85. box-shadow: 0 -4rpx 14rpx rgba(194, 194, 194, 0.5);
  86. z-index: 99999;
  87. padding-bottom: 16rpx;
  88. }
  89. .ipx_button {
  90. height: 130rpx;
  91. }
  92. .tabbar-container{
  93. display: flex;
  94. justify-content: space-between;
  95. }
  96. .tabbar-container>view{
  97. width: 20%;
  98. text-align: center;
  99. padding-top: 16rpx;
  100. }
  101. .tabbar-container>view>text{
  102. display: block;
  103. margin-top: 4rpx;
  104. font-size: 22rpx;
  105. line-height: 20rpx;
  106. }
  107. .tabbar-image{
  108. display: inline-block;
  109. width: 46rpx;
  110. height: 46rpx;
  111. }
  112. /* .tabbar-container>view:nth-child(3) {
  113. margin-top: -54rpx;
  114. }
  115. .tabbar-container>view:nth-child(3) .image_box {
  116. width: 108rpx;
  117. background: #fff;
  118. border-radius: 50%;
  119. text-align: center;
  120. margin: auto;
  121. padding-top: 15rpx;
  122. }
  123. .tabbar-container>view:nth-child(3) image {
  124. width: 80rpx;
  125. height: 80rpx;
  126. } */
  127. .center {
  128. width: 108rpx;
  129. height: 108rpx;
  130. border-radius: 50%;
  131. position: fixed;
  132. bottom: 40rpx;
  133. left: 0;
  134. right: 0;
  135. margin: auto;
  136. box-shadow: 0 -4rpx 14rpx rgba(194, 194, 194, 0.5);
  137. z-index: 1;
  138. }
  139. </style>