鸿宇研学生前端代码
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.

113 lines
2.3 KiB

3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
3 weeks ago
  1. <template>
  2. <view class="tabbar-box">
  3. <view class="tabbar">
  4. <view :class="{ 'tabbar-active' : select == item.key}" v-for="(item, index) in list" :key="index"
  5. v-if="!item.isNotShop || !userShop" @click="toPath(item, index)" class="tabbar-item">
  6. <view class="tabbar-icon">
  7. <image :src="select == item.key ?
  8. item.selectedIconPath :
  9. item.iconPath" class="tabbar-icon-image" mode="aspectFill"></image>
  10. </view>
  11. <view class="tabbar-title">
  12. {{ item.title }}
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import {
  20. mapGetters
  21. } from 'vuex'
  22. export default {
  23. name: "tabbar",
  24. props: ['select'],
  25. computed: {
  26. ...mapGetters(['userShop']),
  27. },
  28. data() {
  29. return {
  30. list: [
  31. {
  32. "selectedIconPath": "/static/image/tabbar/home-active.png",
  33. "iconPath": "/static/image/tabbar/home.png",
  34. "pagePath": "/pages/index/index",
  35. "title": "首页",
  36. key: 'home',
  37. },
  38. {
  39. "selectedIconPath": "/static/image/tabbar/category-active.png",
  40. "iconPath": "/static/image/tabbar/category.png",
  41. "pagePath": "/pages/index/category",
  42. "title": "分类",
  43. key: 'category',
  44. },
  45. ]
  46. };
  47. },
  48. methods: {
  49. toPath(item, index) {
  50. if (item.key == this.select) {
  51. return
  52. }
  53. uni.reLaunch({
  54. url: item.pagePath
  55. })
  56. },
  57. }
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .tabbar-box {
  62. height: 120rpx;
  63. padding-bottom: env(safe-area-inset-bottom);
  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: #999999;
  78. .tabbar-item {
  79. flex: 1;
  80. display: flex;
  81. flex-direction: column;
  82. justify-content: center;
  83. align-items: center;
  84. .tabbar-icon {
  85. width: 54rpx;
  86. height: 54rpx;
  87. .tabbar-icon-image {
  88. width: 54rpx;
  89. height: 54rpx;
  90. }
  91. }
  92. .tabbar-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. .tabbar-active {
  102. color: #181818 !important;
  103. }
  104. }
  105. }
  106. </style>