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.

135 lines
2.7 KiB

9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="list">
  3. <view
  4. :class="{item : true, active : select == index}"
  5. @click="toPath(item, index)"
  6. v-for="(item, index) in list">
  7. <view class="icon">
  8. <image :src="select == index ? item.selectedIconPath : item.iconPath" class="icon-image" mode=""></image>
  9. </view>
  10. <view class="title">
  11. {{ $t(item.title) }}
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <!-- "tabBar": {
  17. "backgroundColor": "white",
  18. "selectedColor": "#cd0000",
  19. "list": [
  20. {
  21. "selectedIconPath": "/static/tabbar/2.png",
  22. "iconPath": "/static/tabbar/1.png",
  23. "pagePath": "pages/home/home",
  24. "text": "%tabbar.title.1%"
  25. },{
  26. "selectedIconPath": "/static/tabbar/4.png",
  27. "iconPath": "/static/tabbar/3.png",
  28. "pagePath": "pages/cart/cart",
  29. "text": "%tabbar.title.2%"
  30. },{
  31. "selectedIconPath": "/static/tabbar/6.png",
  32. "iconPath": "/static/tabbar/5.png",
  33. "pagePath": "pages/order/order",
  34. "text": "%tabbar.title.3%"
  35. }
  36. ]
  37. } -->
  38. <script>
  39. export default {
  40. props : ['select'],
  41. data() {
  42. return {
  43. "list": [
  44. {
  45. "selectedIconPath": "/static/tabbar/2.png",
  46. "iconPath": "/static/tabbar/1.png",
  47. "pagePath": "/pages/home/home",
  48. "title": "tabbar.title.1"
  49. },{
  50. "selectedIconPath": "/static/tabbar/4.png",
  51. "iconPath": "/static/tabbar/3.png",
  52. "pagePath": "/pages/prizeDraw/prizeDraw",
  53. "title": "tabbar.title.2"
  54. },{
  55. "selectedIconPath": "/static/tabbar/6.png",
  56. "iconPath": "/static/tabbar/5.png",
  57. "pagePath": "/pages/order/order",
  58. "title": "tabbar.title.3"
  59. }
  60. ]
  61. }
  62. },
  63. methods: {
  64. toPath(item, index){
  65. if(index == this.select){
  66. return
  67. }
  68. this.$play()
  69. uni.redirectTo({
  70. url: item.pagePath
  71. })
  72. },
  73. }
  74. }
  75. </script>
  76. <style scoped lang="scss">
  77. .list{
  78. position: fixed;
  79. width: 100vw;
  80. // background-color: #aec438;
  81. background-color: #fff;
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. height: 120rpx;
  86. z-index: 999;
  87. font-size: 20rpx;
  88. bottom: 0;
  89. left: 0;
  90. line-height: 50rpx;
  91. color: #000;
  92. .item:nth-child(2){
  93. .icon{
  94. .icon-image{
  95. width: 95rpx;
  96. height: 95rpx;
  97. margin-top: -55rpx;
  98. }
  99. }
  100. }
  101. .item{
  102. flex: 1;
  103. display: flex;
  104. flex-direction: column;
  105. justify-content: center;
  106. align-items: center;
  107. .icon{
  108. width: 100%;
  109. height: 50%;
  110. display: flex;
  111. justify-content: center;
  112. align-items: center;
  113. .icon-image{
  114. width: 40rpx;
  115. height: 40rpx;
  116. }
  117. }
  118. .icon-image{
  119. width: 100%;
  120. height: 50%;
  121. }
  122. .title{
  123. overflow:hidden;
  124. white-space: nowrap;
  125. text-overflow: ellipsis;
  126. -o-text-overflow:ellipsis;
  127. }
  128. }
  129. }
  130. .active{
  131. color: #000 !important;
  132. font-weight: 900;
  133. }
  134. </style>