navbars.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: 100rpx;
  83. height: 100rpx;
  84. margin: 0 auto;
  85. position: relative;
  86. .icon-image {
  87. width: 100rpx;
  88. height: 100rpx;
  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. }
  109. }
  110. </style>