index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="content">
  3. <custom-layout ref="layout" :showBottom="true" :back="{show:false,logoShow:true}" v-model="dataList"
  4. @layoutquery="onQueryList" @scroll="onScroll">
  5. <template #navBarLeft>
  6. <view class="search-bar_top ml10">
  7. <up-search placeholder="卡皮巴拉" :showAction="false" borderColor="rgba(0, 224, 176, 1)"
  8. v-model="searchValue"></up-search>
  9. </view>
  10. </template>
  11. <template #content>
  12. <up-sticky offset-top="0" customNav-height="0" :bg-color="scrollTop > 40 ? bgColor:''">
  13. <up-tabs :list="tabs" :line-height="0"
  14. :active-style="{'fontSize':'30rpx','fontWeight':'600'}"></up-tabs>
  15. </up-sticky>
  16. <view class="demo-uni-row">
  17. <view class="demo-uni-col" v-for="(item,index) in dataList" :key="index"></view>
  18. </view>
  19. </template>
  20. </custom-layout>
  21. </view>
  22. </template>
  23. <script setup>
  24. import {
  25. ref,
  26. onMounted,
  27. computed
  28. } from 'vue';
  29. import {
  30. onShow,
  31. } from "@dcloudio/uni-app";
  32. import useSystemStore from "~@/store/system.js"
  33. // 引入状态管理参数
  34. const {
  35. bgColor
  36. } = useSystemStore()
  37. // 定义变量内容
  38. const searchValue = ref('卡皮巴拉')
  39. const tabs = ref([{
  40. state: -1,
  41. name: '热门新款',
  42. },
  43. {
  44. state: 1,
  45. name: '简约'
  46. },
  47. {
  48. state: 2,
  49. name: '卡通'
  50. },
  51. {
  52. state: 3,
  53. name: '复古'
  54. },
  55. {
  56. state: 4,
  57. name: '运动'
  58. },
  59. {
  60. state: 5,
  61. name: '艺术'
  62. }, {
  63. state: 6,
  64. name: '节日'
  65. }
  66. ])
  67. const activeIndex = ref(-1)
  68. const tabClick = (index, name) => {
  69. console.log(index, name);
  70. }
  71. // 业务列表
  72. const dataList = ref([{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, ])
  73. const num = ref(1)
  74. const layout = ref()
  75. const onQueryList = (event) => {
  76. const {
  77. pageNo,
  78. pageSize
  79. } = event
  80. if (pageNo > 1) {
  81. if (num.value < 2) {
  82. num.value++
  83. layout.value.complete(dataList.value);
  84. } else {
  85. layout.value.complete([]);
  86. }
  87. } else {
  88. num.value = 2
  89. layout.value.complete(dataList.value);
  90. }
  91. }
  92. // 检测页面滚动
  93. const scrollTop = ref(0)
  94. const onScroll = (event) => {
  95. scrollTop.value = event
  96. }
  97. // 生命中期
  98. onMounted(() => {
  99. })
  100. </script>
  101. <style lang="scss" scoped>
  102. .search-bar_top {
  103. width: 46vw;
  104. }
  105. // ======导航标签right标签=======
  106. .tabs_list_box {
  107. padding: 0 26rpx;
  108. width: 100vw;
  109. box-sizing: border-box;
  110. background: var(--bgColor);
  111. .tabs-rigth-fixed {
  112. background: rgba(149, 250, 213, 1);
  113. border-radius: 50rpx;
  114. height: 40rpx;
  115. line-height: 40rpx;
  116. display: flex;
  117. align-items: center;
  118. padding: 0 6rpx;
  119. box-sizing: border-box;
  120. font-size: 20rpx;
  121. font-family: SmileySans-Oblique-2;
  122. text {
  123. font-weight: 600;
  124. }
  125. }
  126. }
  127. // ======liet样式=======
  128. .demo-uni-row {
  129. width: 100%;
  130. padding: 0 26rpx;
  131. margin-top: 20rpx;
  132. box-sizing: border-box;
  133. display: flex;
  134. flex-wrap: wrap;
  135. .demo-uni-col {
  136. width: calc((100% / 2) - 6rpx);
  137. height: 500rpx;
  138. background-color: #ccc;
  139. border-radius: 13px;
  140. margin-bottom: 10rpx;
  141. &:nth-child(2n - 1) {
  142. margin-right: 10rpx;
  143. }
  144. }
  145. }
  146. </style>