景徳镇旅游微信小程序
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.

106 lines
2.1 KiB

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