index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="header">
  3. <view class="top-box">
  4. <image v-if="componentContent.logoType === 1" class="logo" :src="componentContent.imageUrl" mode="heightFix">
  5. </image>
  6. <view
  7. v-else class="h3"
  8. :style="{ fontSize: componentContent.fontSizeNum + 'px', fontWeight: componentContent.textFontW, color: componentContent.titColor }"
  9. >
  10. {{ componentContent.title }}
  11. </view>
  12. <view class="search-btn" @click="searchPro">
  13. <image class="search-icon" src="../../../../../static/images/store/search.png" mode="widthFix"></image>
  14. </view>
  15. </view>
  16. <view class="tabs-nav-warp">
  17. <scroll-view class="tabs-nav" scroll-x="true">
  18. <view class="ul">
  19. <view class="li" :class="{ 'on': activeTab === 0 }" @click="tabChange(0)">首页</view>
  20. <view
  21. v-for="(item, index) in classifyData" :key="index" class="li" :class="{ 'on': activeTab === index + 1 }"
  22. @click="tabChange(index + 1, item.id)"
  23. >
  24. {{ item.categoryName }}
  25. </view>
  26. </view>
  27. </scroll-view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import { commonMixin } from '../mixin'
  33. export default {
  34. mixins: [ commonMixin ],
  35. data() {
  36. return {
  37. activeTab: 0
  38. }
  39. },
  40. computed: {
  41. },
  42. methods: {
  43. tabChange(index, id) {
  44. this.activeTab = index
  45. this.$emit('tabChange', index, id)
  46. },
  47. searchPro(key, type) {
  48. uni.navigateTo({
  49. url: `/another-tf/another-serve/search/index`
  50. })
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .header {
  57. .top-box {
  58. display: flex;
  59. align-items: center;
  60. justify-content: space-between;
  61. padding-left: 30upx;
  62. width: 100%;
  63. .logo {
  64. // width: 280upx;
  65. height: 70upx;
  66. margin-top: 0upx;
  67. }
  68. .search-btn {
  69. height: 66upx;
  70. background: rgba(255, 255, 255, 1);
  71. border-radius: 33upx;
  72. display: flex;
  73. flex-direction: row;
  74. align-items: center;
  75. margin-right: 30upx;
  76. .search-icon {
  77. width: 60upx;
  78. height: 60upx;
  79. }
  80. }
  81. }
  82. }
  83. .tabs-nav-warp {
  84. margin-top: 20upx;
  85. padding: 0 30upx;
  86. overflow: hidden;
  87. .tabs-nav {
  88. .ul {
  89. display: flex;
  90. flex-wrap: nowrap;
  91. justify-content: space-between;
  92. .li {
  93. flex: 1 0 auto;
  94. margin-left: 36upx;
  95. font-size: 30upx;
  96. color: #999999;
  97. position: relative;
  98. padding-bottom: 18upx;
  99. text-align: center;
  100. &:first-child {
  101. margin-left: 0;
  102. }
  103. &.on {
  104. &:after {
  105. content: '';
  106. width: 100%;
  107. height: 4upx;
  108. background: #C5AA7B;
  109. position: absolute;
  110. left: 0;
  111. bottom: 0;
  112. }
  113. font-weight:bold;
  114. }
  115. }
  116. }
  117. }
  118. }
  119. </style>