商城点单小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
3.6 KiB

3 weeks ago
  1. <template>
  2. <view class="page">
  3. <navbar/>
  4. <view class="category">
  5. <uv-vtabs
  6. :chain="chain"
  7. :list="category"
  8. height="1000px"
  9. :barItemBadgeStyle="{right:'20px',top:'12px'}"
  10. @change="change">
  11. <uv-vtabs-item>
  12. <view class="category-title">
  13. 租赁
  14. </view>
  15. <view class="list">
  16. <view class="item" v-for="(item,index) in list" :key="index"
  17. @click="$utils.navigateTo('/pages_order/product/productDetail?id=123')">
  18. <view class="item-image">
  19. <image
  20. :src="item.image"
  21. mode="aspectFill"></image>
  22. </view>
  23. <view class="item-unit">
  24. <text class="text">{{item.unit}}</text>
  25. </view>
  26. </view>
  27. </view>
  28. </uv-vtabs-item>
  29. </uv-vtabs>
  30. </view>
  31. <tabber select="category" />
  32. </view>
  33. </template>
  34. <script>
  35. import tabber from '@/components/base/tabbar.vue'
  36. export default {
  37. components: {
  38. tabber,
  39. },
  40. data() {
  41. return {
  42. category: [
  43. {
  44. name : '桌布'
  45. },
  46. {
  47. name : '桌布'
  48. },
  49. {
  50. name : '桌布'
  51. },
  52. ],
  53. list : [
  54. {
  55. unit : '100*50*60',
  56. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  57. },
  58. {
  59. unit : '100*50*60',
  60. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  61. },
  62. {
  63. unit : '100*50*60',
  64. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  65. },
  66. {
  67. unit : '100*50*60',
  68. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  69. },
  70. {
  71. unit : '100*50*60',
  72. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  73. },
  74. {
  75. unit : '100*50*60',
  76. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  77. },
  78. {
  79. unit : '100*50*60',
  80. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  81. },
  82. {
  83. unit : '100*50*60',
  84. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  85. },
  86. {
  87. unit : '100*50*60',
  88. image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
  89. },
  90. ],
  91. chain: false,
  92. value: 0
  93. }
  94. },
  95. computed: {
  96. list2() {
  97. const _list = this.list[this.value]?.childrens;
  98. return _list ? _list : [];
  99. }
  100. },
  101. onReady() {
  102. },
  103. methods: {
  104. change(index) {
  105. console.log('选项改变:', index)
  106. this.value = index;
  107. }
  108. }
  109. }
  110. </script>
  111. <style scoped lang="scss">
  112. .page{
  113. /deep/ .uv-vtabs{
  114. height: calc(100vh - 360rpx) !important;
  115. }
  116. /deep/ .uv-vtabs__bar{
  117. height: calc(100vh - 360rpx) !important;
  118. }
  119. /deep/ .uv-vtabs__content{
  120. height: calc(100vh - 360rpx) !important;
  121. }
  122. }
  123. .category {
  124. font-size: 30rpx;
  125. color: #333;
  126. .category-title{
  127. position: relative;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. height: 120rpx;
  132. &::before,
  133. &::after {
  134. position: absolute;
  135. top: 50%;
  136. content: '';
  137. width: 10%;
  138. border-top: 2rpx solid black;
  139. }
  140. &::before {
  141. left: 25%;
  142. }
  143. &::after {
  144. right: 25%;
  145. }
  146. }
  147. .list{
  148. display: flex;
  149. flex-wrap: wrap;
  150. margin: 0 auto;
  151. width: 490rpx;
  152. .item {
  153. padding: 10rpx 20rpx;
  154. display: flex;
  155. flex-direction: column;
  156. justify-content: center;
  157. align-items: center;
  158. margin-bottom: 20rpx;
  159. .item-image {
  160. width: 120rpx;
  161. height: 120rpx;
  162. image{
  163. height: 100%;
  164. width: 100%;
  165. border-radius: 50%;
  166. }
  167. }
  168. .item-unit {
  169. font-size: 24rpx;
  170. margin-top: 15rpx;
  171. color: #555;
  172. }
  173. }
  174. .gap {
  175. padding: 0 30rpx;
  176. }
  177. }
  178. }
  179. </style>