x-navbottom.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <!-- 底部tabbar -->
  3. <view class="navmainbox">
  4. <view class="navigation">
  5. <view class="navcont" v-for="(item,index) in dataList" :key="index" @click="gonavs(item,index)">
  6. <span class="iconfont icon_image" :class="[item.icon,nowchos == index ? 'activeName' :'']"></span>
  7. <view class="navchosbox" :class="nowchos == index ? 'activeName' :''">
  8. {{item.title}}
  9. </view>
  10. </view>
  11. </view>
  12. <!-- //防止 固定的底部菜单遮挡页面上的内容 -->
  13. <view class="navmainbox" style="position: relative;opacity: 0;z-index: 0;">
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'x-navbottom',
  20. props: {
  21. nowchos: {
  22. type: Number,
  23. default () {
  24. return 0
  25. }
  26. },
  27. },
  28. data() {
  29. return {
  30. dataList: [],
  31. list: [{
  32. icon: 'icon-shouye',
  33. title: '首页',
  34. }, {
  35. icon: 'icon-dingdan',
  36. title: '订单',
  37. }, {
  38. icon: 'icon-a-xiaoxi',
  39. title: '消息',
  40. }, {
  41. icon: 'icon-wode',
  42. title: '我的',
  43. }],
  44. gasList: [{
  45. icon: 'icon-shouye',
  46. title: '首页',
  47. }, {
  48. icon: 'icon-wode',
  49. title: '我的',
  50. }],
  51. }
  52. },
  53. mounted() {
  54. var userInfo = this.$cache.getCache('userInfo')
  55. if(userInfo.provUser){
  56. if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {
  57. this.dataList = this.list
  58. } else {
  59. this.dataList = this.gasList
  60. }
  61. }else{
  62. this.dataList = this.list
  63. }
  64. },
  65. methods: {
  66. gonavs(e, cindex) {
  67. this.$emit('botomchos', cindex)
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. .navmainbox {
  74. position: fixed;
  75. bottom: 0;
  76. left: 0;
  77. z-index: 5;
  78. background-color: #ffffff;
  79. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  80. width: 100%;
  81. height: 100rpx;
  82. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  83. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  84. }
  85. .navigation {
  86. z-index: 2024;
  87. position: relative;
  88. display: flex;
  89. justify-content: center;
  90. align-items: center;
  91. height: 100rpx;
  92. padding-bottom: var(--window-bottom);
  93. }
  94. .navigation .navcont {
  95. position: relative;
  96. display: flex;
  97. flex-direction: column;
  98. align-items: center;
  99. flex: 1;
  100. }
  101. .navchosbox {
  102. color: #727289 !important;
  103. margin-top: 2rpx;
  104. font-size: 26rpx;
  105. }
  106. .activeName {
  107. color: #3E80FF !important;
  108. }
  109. .icon_image {
  110. font-size: 44rpx;
  111. }
  112. </style>