navbars.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template name="navbars">
  2. <view class="navbar">
  3. <view class="navbars-content clearfix">
  4. <view class="nav-item" v-for="(item, index) in navList" :key="index" @click="NavToDetailPage(item, index)">
  5. <view class="icon"> <image class="icon-image" :src="item.icon" mode="widthFix"></image> </view>
  6. <view class="name">{{ item.name }}</view>
  7. </view>
  8. <view class="nav-item" @click="handleMore" v-if="list.length > 9">
  9. <view class="icon">
  10. <image
  11. class="icon-image"
  12. src="https://static.caimei365.com/app/img/icon/icon-navs-more@2x.png"
  13. mode="widthFix"
  14. ></image>
  15. </view>
  16. <view class="name">更多</view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: 'navbars',
  24. props: {
  25. list: {
  26. type: Array
  27. }
  28. },
  29. data() {
  30. return {
  31. current: 100,
  32. navList: []
  33. }
  34. },
  35. created() {
  36. this.initData(this.list)
  37. },
  38. computed: {},
  39. methods: {
  40. initData(list) {
  41. this.navList = list.slice(0, 9)
  42. },
  43. handleMore() {
  44. this.$api.navigateTo(`/pages/goods/channel`)
  45. },
  46. NavToDetailPage(pros, index) {
  47. //跳转
  48. if (index === 3) {
  49. let linkPath = 'https://static.caimei365.com/app/caimei-activity-h5/html/2023/activity_02.html'
  50. this.$api.navigateTo(`/pages/h5/activity/activity?link=${linkPath}&linkId=382`)
  51. } else {
  52. /**
  53. * 页面跳转
  54. **/
  55. this.$api.FlooryNavigateTo(pros)
  56. }
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .navbar {
  63. background: #f7f7f7;
  64. display: flex;
  65. align-items: center;
  66. justify-content: center;
  67. }
  68. .navbars-content {
  69. width: 94%;
  70. height: auto;
  71. box-sizing: border-box;
  72. padding: 20rpx 0 0 0;
  73. background-color: #fff;
  74. border-radius: 16rpx;
  75. margin-top: 14rpx;
  76. .nav-item {
  77. width: 20%;
  78. height: auto;
  79. float: left;
  80. margin-bottom: 30rpx;
  81. .icon {
  82. width: 110rpx;
  83. height: 110rpx;
  84. margin: 0 auto;
  85. position: relative;
  86. .icon-image {
  87. width: 110rpx;
  88. height: 110rpx;
  89. display: block;
  90. }
  91. .icon-new {
  92. width: 44rpx;
  93. height: 22rpx;
  94. display: block;
  95. position: absolute;
  96. right: 0;
  97. top: 20rpx;
  98. }
  99. }
  100. .name {
  101. width: 100%;
  102. height: 40rpx;
  103. line-height: 40rpx;
  104. text-align: center;
  105. font-size: $font-size-26;
  106. color: #666666;
  107. }
  108. .nav-cell-main {
  109. width: 100%;
  110. height: auto;
  111. position: absolute;
  112. right: 0;
  113. .nav-cell {
  114. width: 164rpx;
  115. height: auto;
  116. float: left;
  117. margin-bottom: 30rpx;
  118. margin-right: 15.3rpx;
  119. &:nth-child(4) {
  120. margin-right: 0;
  121. }
  122. &:nth-child(8) {
  123. margin-right: 0;
  124. }
  125. .icon {
  126. width: 130rpx;
  127. height: 130rpx;
  128. margin: 0 auto;
  129. position: relative;
  130. .icon-image {
  131. width: 130rpx;
  132. height: 130rpx;
  133. display: block;
  134. }
  135. .icon-new {
  136. width: 44rpx;
  137. height: 22rpx;
  138. display: block;
  139. position: absolute;
  140. right: 0;
  141. top: 20rpx;
  142. }
  143. }
  144. .name {
  145. width: 100%;
  146. height: 40rpx;
  147. line-height: 40rpx;
  148. text-align: center;
  149. font-size: $font-size-28;
  150. color: #666666;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. </style>