customTab.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view>
  3. <view v-if="newData.status && newData.status.status" style="height: 100rpx;"></view>
  4. <view class="foot" v-if="newData.status && newData.status.status">
  5. <view class="page-footer" id="target" :style="{'background-color':newData.bgColor.color[0].item}">
  6. <view class="foot-item" v-for="(item,index) in newData.menuList" :key="index"
  7. @click="goRouter(item)">
  8. <block v-if="item.link == activeRouter">
  9. <image :src="item.imgList[0]"></image>
  10. <view class="txt" :style="{color:newData.activeTxtColor.color[0].item}">{{item.name}}
  11. </view>
  12. </block>
  13. <block v-else>
  14. <image :src="item.imgList[1]"></image>
  15. <view class="txt" :style="{color:newData.txtColor.color[0].item}">{{item.name}}</view>
  16. </block>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. // +----------------------------------------------------------------------
  24. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  25. // +----------------------------------------------------------------------
  26. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  27. // +----------------------------------------------------------------------
  28. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  29. // +----------------------------------------------------------------------
  30. // | Author: CRMEB Team <admin@crmeb.com>
  31. // +----------------------------------------------------------------------
  32. export default{
  33. props: {
  34. newData: {
  35. type: Object,
  36. default: {},
  37. },
  38. activeRouter: {
  39. type: String,
  40. default: '',
  41. }
  42. },
  43. data(){
  44. return {
  45. }
  46. },
  47. mounted() {
  48. },
  49. methods:{
  50. goRouter(item) {
  51. var pages = getCurrentPages();
  52. var page = (pages[pages.length - 1]).$page.fullPath;
  53. if (item.link == page) return
  54. uni.switchTab({
  55. url: item.link,
  56. fail(err) {
  57. uni.redirectTo({
  58. url: item.link
  59. })
  60. }
  61. })
  62. },
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .page-footer {
  68. position: fixed;
  69. bottom: 0;
  70. z-index: 30;
  71. display: flex;
  72. align-items: center;
  73. justify-content: space-around;
  74. width: 100%;
  75. height: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  76. height: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  77. box-sizing: border-box;
  78. border-top: 1px solid #F3F3F3;
  79. background-color: #fff;
  80. box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  81. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  82. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  83. &.filter{
  84. filter: blur(2rpx);
  85. }
  86. .foot-item {
  87. display: flex;
  88. width: max-content;
  89. align-items: center;
  90. justify-content: center;
  91. flex-direction: column;
  92. position: relative;
  93. .count-num {
  94. position: absolute;
  95. display: flex;
  96. justify-content: center;
  97. align-items: center;
  98. width: 40rpx;
  99. height: 40rpx;
  100. top: 0rpx;
  101. right: -15rpx;
  102. color: #fff;
  103. font-size: 20rpx;
  104. background-color: #FD502F;
  105. border-radius: 50%;
  106. padding: 4rpx;
  107. }
  108. }
  109. .foot-item image {
  110. height: 50rpx;
  111. width: 50rpx;
  112. text-align: center;
  113. margin: 0 auto;
  114. }
  115. .foot-item .txt {
  116. font-size: 24rpx;
  117. }
  118. }
  119. </style>