index-tab-menu.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="content" :style="[{background:backGround}]">
  3. <view class="nav_wrap">
  4. <view class="nav_item" v-for="(item,index) in tabInfo" :key="index" @click="changeTab(index,item.labelId,item)">
  5. <view :class="currIndex == index?'active_nav nav_text':'nav_text'">{{item.labelName}}</view>
  6. <image :src="icon" mode="" class="nav_icon" v-if="currIndex == index"></image>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default{
  13. name:'tabMenu',
  14. data(){
  15. return {
  16. icon:getApp().globalData.imgUrl+'index/icon.png',
  17. sortImg:getApp().globalData.imgUrl+'index/sort.png',
  18. currIndex:0
  19. }
  20. },
  21. props: ['backGround','tabInfo'],
  22. methods:{
  23. changeTab(index,labelId){
  24. this.currIndex = index
  25. if(index>0){
  26. let param = {}
  27. param.data={}
  28. param.data.labelId=labelId
  29. param.url = 'v3/integral/front/integral/mall/list'
  30. param.method = 'GET'
  31. this.$request(param).then(res => {
  32. if (res.state == 200) {
  33. this.$emit('getChildList',res.data.list[index-1],index)
  34. }
  35. })
  36. }else{
  37. this.$emit('getChildList',null,index)
  38. }
  39. },
  40. toSortPage(){
  41. uni.switchTab({
  42. url:`/pages/category/category`
  43. })
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang='scss'>
  49. .content{
  50. position:fixed;
  51. top:0;
  52. /* left:0; */
  53. /* #ifdef APP-PLUS */
  54. top: var(--status-bar-height);
  55. /* #endif */
  56. width:750rpx;
  57. padding:0 20rpx;
  58. box-sizing: border-box;
  59. display: flex;
  60. align-items: center;
  61. padding-top:110rpx;
  62. /* #ifdef MP */
  63. padding-top:102rpx;
  64. /* #endif */
  65. background: #7B2AD0;
  66. z-index: 1000;
  67. /* #ifndef H5 */
  68. left: 0;
  69. /* #endif */
  70. height: 160rpx;
  71. overflow-y: hidden;
  72. .nav_wrap{
  73. height:84rpx;
  74. display:flex;
  75. overflow-x: scroll;
  76. float: left;
  77. .nav_item{
  78. margin-right:35rpx;
  79. display:flex;
  80. flex-direction: column;
  81. align-items: center;
  82. padding-top:12rpx;
  83. box-sizing: border-box;
  84. .nav_text{
  85. font-size:32rpx;
  86. color:#fff;
  87. white-space: nowrap;
  88. line-height: 38rpx;
  89. }
  90. .nav_icon{
  91. width:27rpx;
  92. height:9rpx;
  93. }
  94. }
  95. }
  96. .gap_line{
  97. width:13rpx;
  98. height:30rpx;
  99. background: linear-gradient(-90deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
  100. opacity: 0.8;
  101. float: left;
  102. margin-right:6rpx;
  103. margin-left: 4rpx;
  104. align-self: end;
  105. margin-top: 17rpx;
  106. }
  107. .sort_wrap{
  108. font-size:30rpx;
  109. color:#fff;
  110. display: flex;
  111. justify-content: flex-start;
  112. box-sizing: border-box;
  113. float: right;
  114. text-align: right;
  115. width: max-content;
  116. margin-top: -9rpx;
  117. image{
  118. width:32rpx;
  119. height:26rpx;
  120. margin:0 7rpx 0 7rpx;
  121. }
  122. text{
  123. line-height:30rpx;
  124. }
  125. }
  126. }
  127. .active_nav{
  128. font-weight: bold;
  129. margin-bottom:6rpx;
  130. }
  131. </style>