酒店桌布为微信小程序
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.

128 lines
2.7 KiB

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