liveh5-nuxt/app/stores/goods/index.js
xingyy fc3e833605 fix(home): 修复 home 页面无限滚动加载问题
- 调整 pageRef 的初始值,将 page 设置为 0
- 在 ItemList 组件中添加完成加载的判断条件
- 优化 getDetail 函数,使用 currentItem.value.uuid 替代 artworkUuid
-移除首页初始化数据加载逻辑
2025-01-22 09:32:24 +08:00

40 lines
1.1 KiB
JavaScript

import {createGlobalState} from '@vueuse/core'
import {artworkList, defaultDetail} from "~/api/goods/index.js";
export const goodStore = createGlobalState(() => {
const actionDetails = ref({})
const fullLive = ref(false)
const liveRef = ref(null);
const currentItem=ref({})
const myArtWorks=ref([])
const pageRef = ref({
page: 0,
pageSize: 5,
itemCount: 0
})
const artWorkDetail=ref(null)
const itemList = ref([])
const auctionDetail = ref({})
const getAuctionDetail = async () => {
const res = await defaultDetail({})
if (res.status === 0) {
auctionDetail.value = res.data
}
}
const getArtworkList = async (page = pageRef.value) => {
return artworkList({auctionUuid: auctionDetail.value.uuid, ...page})
}
return {
myArtWorks,
currentItem,
artWorkDetail,
liveRef,
pageRef,
getArtworkList,
auctionDetail,
getAuctionDetail,
actionDetails,
itemList,
fullLive
}
})