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

102 lines
2.0 KiB

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