index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <script setup lang="ts">
  2. import homeList from './components/homeList.vue'
  3. import orderList from './components/orderList.vue'
  4. const tabbar = ref(0)
  5. const { opcity } = storeToRefs(useSysStore())
  6. definePage({
  7. name: 'attractions-tabbar',
  8. islogin: false,
  9. style: {
  10. navigationBarTitleText: '',
  11. navigationStyle: 'custom',
  12. },
  13. })
  14. onLoad((options: any) => {
  15. if (options.tabbar) {
  16. tabbar.value = Number(options.tabbar)
  17. }
  18. })
  19. // 页面级滚动监听 - 必须在页面组件中才能生效
  20. onPageScroll((e) => {
  21. if (tabbar.value === 0) {
  22. const calculatedOpacity = e.scrollTop / 100
  23. opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
  24. }
  25. })
  26. </script>
  27. <template>
  28. <view class="">
  29. <home-list v-if="tabbar === 0" />
  30. <order-list v-if="tabbar === 1" />
  31. <view class="">
  32. <wd-tabbar v-model="tabbar" safe-area-inset-bottom placeholder fixed :bordered="false" :z-index="99999">
  33. <wd-tabbar-item title="列表" icon="goods">
  34. <template #icon>
  35. <i class="iconfont text-44rpx" :class="[tabbar === 0 ? 'text-[var(--them-color)]' : '']">&#xe63a;</i>
  36. </template>
  37. </wd-tabbar-item>
  38. <wd-tabbar-item title="订单记录" icon="list">
  39. <template #icon>
  40. <i class="iconfont text-44rpx" :class="[tabbar === 1 ? 'text-[var(--them-color)]' : '']">&#xe645;</i>
  41. </template>
  42. </wd-tabbar-item>
  43. </wd-tabbar>
  44. </view>
  45. </view>
  46. </template>
  47. <style lang="scss" scoped></style>