fenlei.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view>
  3. <mp-vtabs :vtabs="vtabs" :activeTab="activeTab" @tabclick="onTabCLick" @change="onChange">
  4. <block v-for="(item, index) in vtabs" :key="index">
  5. <mp-vtabs-content :tabIndex="index">
  6. <view class="vtabs-content-item">
  7. <span class="vtabs-contentTitle">{{ item.title }}</span>
  8. <ul class="spflList">
  9. <li>
  10. <image src="/static/pages/images/ty.png"></image>
  11. <span>体育用品</span>
  12. </li>
  13. <li>
  14. <image src="/static/pages/images/tongzhuan.png"></image>
  15. <span>童装</span>
  16. </li>
  17. <li>
  18. <image src="/static/pages/images/waitao.png"></image>
  19. <span>外套</span>
  20. </li>
  21. <li>
  22. <image src="/static/pages/images/yumi.png"></image>
  23. <span>农产品</span>
  24. </li>
  25. </ul>
  26. </view>
  27. </mp-vtabs-content>
  28. </block>
  29. </mp-vtabs>
  30. </view>
  31. </template>
  32. <script>
  33. import mpVtabs from '../../../components/vtabs/vtabs/index.vue';
  34. import mpVtabsContent from '../../../components/vtabs/vtabs-content/index.vue';
  35. // pages/fenlei.js
  36. export default {
  37. components: {
  38. mpVtabs,
  39. mpVtabsContent
  40. },
  41. data() {
  42. return {
  43. vtabs: [],
  44. activeTab: 0,
  45. test: 111
  46. };
  47. },
  48. onLoad() {
  49. const vtabs = [
  50. {
  51. title: '热搜推荐'
  52. },
  53. {
  54. title: '手机数码'
  55. },
  56. {
  57. title: '家用电器'
  58. },
  59. {
  60. title: '生鲜果蔬'
  61. },
  62. {
  63. title: '酒水饮料'
  64. },
  65. {
  66. title: '生活美食'
  67. },
  68. {
  69. title: '美妆护肤'
  70. },
  71. {
  72. title: '个护清洁'
  73. },
  74. {
  75. title: '女装内衣'
  76. },
  77. {
  78. title: '男装内衣'
  79. },
  80. {
  81. title: '鞋靴箱包'
  82. },
  83. {
  84. title: '运动户外'
  85. },
  86. {
  87. title: '生活充值'
  88. },
  89. {
  90. title: '母婴童装'
  91. }
  92. ];
  93. // const vtabs = titles.map(item => ({title: item}))
  94. this.setData({
  95. vtabs: vtabs
  96. });
  97. },
  98. /**
  99. * 生命周期函数--监听页面初次渲染完成
  100. */
  101. onReady() {},
  102. /**
  103. * 生命周期函数--监听页面显示
  104. */
  105. onShow() {},
  106. /**
  107. * 生命周期函数--监听页面隐藏
  108. */
  109. onHide() {},
  110. /**
  111. * 生命周期函数--监听页面卸载
  112. */
  113. onUnload() {},
  114. /**
  115. * 页面相关事件处理函数--监听用户下拉动作
  116. */
  117. onPullDownRefresh() {},
  118. /**
  119. * 页面上拉触底事件的处理函数
  120. */
  121. onReachBottom() {},
  122. /**
  123. * 用户点击右上角分享
  124. */
  125. onShareAppMessage() {},
  126. methods: {
  127. onTabCLick(e) {
  128. const index = e.detail.index;
  129. console.log('tabClick', index);
  130. },
  131. onChange(e) {
  132. const index = e.detail.index;
  133. console.log('change', index);
  134. }
  135. }
  136. };
  137. </script>
  138. <style>
  139. @import 'fenlei.css';
  140. </style>