|
@ -2,7 +2,7 @@ |
|
|
<view class="viewport"> |
|
|
<view class="viewport"> |
|
|
<!-- 自定义导航栏 --> |
|
|
<!-- 自定义导航栏 --> |
|
|
<CustomNavbar /> |
|
|
<CustomNavbar /> |
|
|
<scroll-view class="scroll-view" scroll-y> |
|
|
|
|
|
|
|
|
<scroll-view @scrolltolower="onScrolltolower" class="scroll-view" scroll-y> |
|
|
<PageSkeleton v-if="isLoading" /> |
|
|
<PageSkeleton v-if="isLoading" /> |
|
|
<!-- 自定义轮播图 --> |
|
|
<!-- 自定义轮播图 --> |
|
|
<XtxSwiper :list="bannerList" /> |
|
|
<XtxSwiper :list="bannerList" /> |
|
@ -11,7 +11,7 @@ |
|
|
<!-- 热门推荐 --> |
|
|
<!-- 热门推荐 --> |
|
|
<HotPanel :list="hotList" /> |
|
|
<HotPanel :list="hotList" /> |
|
|
<!-- 猜你喜欢 --> |
|
|
<!-- 猜你喜欢 --> |
|
|
<XtxGuess /> |
|
|
|
|
|
|
|
|
<XtxGuess ref="guessRef" /> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
@ -24,6 +24,7 @@ import { ref } from 'vue' |
|
|
import { onLoad } from '@dcloudio/uni-app' |
|
|
import { onLoad } from '@dcloudio/uni-app' |
|
|
import { getHomeBannerAPI, getHomeCategoryAPI, getHomeHotAPI } from '@/services/home' |
|
|
import { getHomeBannerAPI, getHomeCategoryAPI, getHomeHotAPI } from '@/services/home' |
|
|
import type { BannerItem, CategoryItem, HotItem } from '@/types/home' |
|
|
import type { BannerItem, CategoryItem, HotItem } from '@/types/home' |
|
|
|
|
|
import type { XtxGuessInstance } from '@/types/component' |
|
|
|
|
|
|
|
|
// 获取轮播图数据 |
|
|
// 获取轮播图数据 |
|
|
const bannerList = ref<BannerItem[]>([]) |
|
|
const bannerList = ref<BannerItem[]>([]) |
|
@ -49,6 +50,14 @@ const getHomeHotData = async () => { |
|
|
// 是否加载中标记 |
|
|
// 是否加载中标记 |
|
|
const isLoading = ref(false) |
|
|
const isLoading = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
// 获取猜你喜欢组件实例 |
|
|
|
|
|
const guessRef = ref<XtxGuessInstance>() |
|
|
|
|
|
|
|
|
|
|
|
// 滚动触底事件 |
|
|
|
|
|
const onScrolltolower = () => { |
|
|
|
|
|
guessRef.value?.getMore() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 页面加载 |
|
|
// 页面加载 |
|
|
onLoad(async () => { |
|
|
onLoad(async () => { |
|
|
isLoading.value = true |
|
|
isLoading.value = true |
|
|