templateNav.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template name="navbars">
  2. <view>
  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">
  6. <image class="icon-image" :src="item.crmIcon" mode=""></image>
  7. </view>
  8. <view class="name">{{ item.name }}</view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default{
  15. name:"navbars",
  16. props:{
  17. list:{
  18. type:Array
  19. }
  20. },
  21. data() {
  22. return{
  23. current:100,
  24. navList:[]
  25. }
  26. },
  27. created(){
  28. this.initData(this.list)
  29. },
  30. computed: {
  31. },
  32. methods:{
  33. initData(list){
  34. this.navList = list
  35. console.log(this.navList)
  36. },
  37. NavToDetailPage(item){//分类导航跳转
  38. this.$api.navigateTo(`/pages/goods/goods-classify?classType=1&id=${item.bigTypeID}&title=${item.name}`)
  39. // uni.setStorage({
  40. // key: 'commodity_id',
  41. // data: pro.tinyTypeID,
  42. // success: function () {
  43. // self.$api.navigateTo(`/pages/goods/goods-classify?title=${pro.name}&id=${pro.bigTypeID}`)
  44. // }
  45. // })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. .navbars-content{
  52. width: 100%;
  53. height: auto;
  54. box-sizing: border-box;
  55. padding: 0 24rpx;
  56. margin-top: 30rpx;
  57. .nav-item{
  58. width: 164rpx;
  59. height: auto;
  60. float: left;
  61. margin-bottom: 30rpx;
  62. margin-right: 15.3rpx;
  63. &:nth-child(4){
  64. margin-right: 0;
  65. }
  66. &:nth-child(8){
  67. margin-right: 0;
  68. }
  69. .icon{
  70. width: 72rpx;
  71. height: 72rpx;
  72. margin: 0 auto;
  73. position: relative;
  74. .icon-image{
  75. width: 72rpx;
  76. height: 72rpx;
  77. display: block;
  78. }
  79. .icon-new{
  80. width: 44rpx;
  81. height: 22rpx;
  82. display: block;
  83. position: absolute;
  84. right: 0;
  85. top: 20rpx;
  86. }
  87. }
  88. .name{
  89. width: 100%;
  90. height: 40rpx;
  91. line-height: 40rpx;
  92. text-align: center;
  93. font-size: $font-size-24;
  94. color: #666666;
  95. }
  96. .nav-cell-main{
  97. width: 100%;
  98. height: auto;
  99. position: absolute;
  100. right: 0;
  101. .nav-cell{
  102. width: 164rpx;
  103. height: auto;
  104. float: left;
  105. margin-bottom: 30rpx;
  106. margin-right: 15.3rpx;
  107. &:nth-child(4){
  108. margin-right: 0;
  109. }
  110. &:nth-child(8){
  111. margin-right: 0;
  112. }
  113. .icon{
  114. width: 130rpx;
  115. height: 130rpx;
  116. margin: 0 auto;
  117. position: relative;
  118. .icon-image{
  119. width: 130rpx;
  120. height: 130rpx;
  121. display: block;
  122. }
  123. .icon-new{
  124. width: 44rpx;
  125. height: 22rpx;
  126. display: block;
  127. position: absolute;
  128. right: 0;
  129. top: 20rpx;
  130. }
  131. }
  132. .name{
  133. width: 100%;
  134. height: 40rpx;
  135. line-height: 40rpx;
  136. text-align: center;
  137. font-size: $font-size-28;
  138. color: #666666;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. </style>