加油站付款小程序,打印小票
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.

103 lines
2.1 KiB

6 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. @click="toPath(item, index)">
  7. <view class="icon">
  8. <image :src="select == index ?
  9. item.selectedIconPath :
  10. item.iconPath" class="icon-image" mode=""></image>
  11. </view>
  12. <view class="title">
  13. {{ $t(item.title) }}
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name:"tabbar",
  21. props : ['select'],
  22. data() {
  23. return {
  24. list : [
  25. {
  26. "selectedIconPath": "/static/image/tabbar/home-a.png",
  27. "iconPath": "/static/image/tabbar/home.png",
  28. "pagePath": "/pages/index/index",
  29. "title": "tabbar.title.1"
  30. },{
  31. "selectedIconPath": "/static/image/tabbar/addressBook-a.png",
  32. "iconPath": "/static/image/tabbar/addressBook.png",
  33. "pagePath": "/pages/index/addressBook",
  34. "title": "tabbar.title.2"
  35. },{
  36. "selectedIconPath": "/static/image/tabbar/discover-a.png",
  37. "iconPath": "/static/image/tabbar/discover.png",
  38. "pagePath": "/pages/index/discover",
  39. "title": "tabbar.title.3"
  40. },{
  41. "selectedIconPath": "/static/image/tabbar/center-a.png",
  42. "iconPath": "/static/image/tabbar/center.png",
  43. "pagePath": "/pages/index/center",
  44. "title": "tabbar.title.3"
  45. }
  46. ]
  47. };
  48. },
  49. methods : {
  50. toPath(item, index){
  51. if(index == this.select){
  52. return
  53. }
  54. uni.redirectTo({
  55. url: item.pagePath
  56. })
  57. },
  58. }
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. .tabbar{
  63. position: fixed;
  64. width: 750rpx;
  65. background-color: #f7f7f7;
  66. display: flex;
  67. justify-content: center;
  68. align-items: center;
  69. flex-direction: row;
  70. height: 120rpx;
  71. z-index: 999999;
  72. bottom: 0;
  73. left: 0;
  74. line-height: 50rpx;
  75. color: #333;
  76. .item{
  77. width: 25%;
  78. display: flex;
  79. flex-direction: column;
  80. justify-content: center;
  81. align-items: center;
  82. .icon{
  83. width: 54rpx;
  84. height: 54rpx;
  85. .icon-image{
  86. width: 54rpx;
  87. height: 54rpx;
  88. }
  89. }
  90. .title{
  91. overflow: hidden;
  92. // white-space: nowrap;
  93. // text-overflow: ellipsis;
  94. // -o-text-overflow: ellipsis;
  95. font-size: 23rpx;
  96. }
  97. }
  98. }
  99. .active{
  100. color: #03c061 !important;
  101. }
  102. </style>