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

109 lines
2.1 KiB

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