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

121 lines
2.5 KiB

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