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.

136 lines
2.7 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 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. box-shadow: 0px 0rpx 10rpx 10rpx #00000022;
  93. .item:nth-child(2){
  94. // .icon{
  95. // .icon-image{
  96. // width: 95rpx;
  97. // height: 95rpx;
  98. // margin-top: -55rpx;
  99. // }
  100. // }
  101. }
  102. .item{
  103. flex: 1;
  104. display: flex;
  105. flex-direction: column;
  106. justify-content: center;
  107. align-items: center;
  108. .icon{
  109. width: 100%;
  110. height: 50%;
  111. display: flex;
  112. justify-content: center;
  113. align-items: center;
  114. .icon-image{
  115. width: 40rpx;
  116. height: 40rpx;
  117. }
  118. }
  119. .icon-image{
  120. width: 100%;
  121. height: 50%;
  122. }
  123. .title{
  124. overflow:hidden;
  125. white-space: nowrap;
  126. text-overflow: ellipsis;
  127. -o-text-overflow:ellipsis;
  128. }
  129. }
  130. }
  131. .active{
  132. color: #000 !important;
  133. font-weight: 900;
  134. }
  135. </style>