|
@@ -11,7 +11,7 @@
|
|
|
<img src="@/assets/subtitle_2.png" />
|
|
|
</span>
|
|
|
</template>
|
|
|
- <n-tab-pane name="all" tab="全部展览">
|
|
|
+ <n-tab-pane name="all" tab="全部展览" v-infinite-scroll="onLoadMore">
|
|
|
<n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
|
|
|
<template v-for="item in exhibitionList">
|
|
|
<n-gi>
|
|
@@ -30,7 +30,7 @@
|
|
|
</n-grid>
|
|
|
<empty :show="exhibitionList.length === 0" :height="500" />
|
|
|
</n-tab-pane>
|
|
|
- <n-tab-pane name="long" tab="常设展览">
|
|
|
+ <n-tab-pane name="long" tab="常设展览" v-infinite-scroll="onLoadMore">
|
|
|
<n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
|
|
|
<template v-for="item in exhibitionList">
|
|
|
<n-gi>
|
|
@@ -48,7 +48,11 @@
|
|
|
</n-grid>
|
|
|
<empty :show="exhibitionList.length === 0" :height="500" />
|
|
|
</n-tab-pane>
|
|
|
- <n-tab-pane name="topic" tab="专题展览">
|
|
|
+ <n-tab-pane
|
|
|
+ name="topic"
|
|
|
+ tab="专题展览"
|
|
|
+ v-infinite-scroll="onLoadMore"
|
|
|
+ >
|
|
|
<n-grid :x-gap="XGap" :y-gap="YGap" :cols="1" class="tab-grid">
|
|
|
<template v-for="item in exhibitionList">
|
|
|
<n-gi>
|
|
@@ -66,7 +70,7 @@
|
|
|
</n-grid>
|
|
|
<empty :show="exhibitionList.length === 0" :height="500" />
|
|
|
</n-tab-pane>
|
|
|
- <n-tab-pane name="temp" tab="临时展览">
|
|
|
+ <n-tab-pane name="temp" tab="临时展览" v-infinite-scroll="onLoadMore">
|
|
|
<n-grid :y-gap="YGap" :cols="1" class="tab-grid">
|
|
|
<template v-for="item in exhibitionList">
|
|
|
<n-gi>
|
|
@@ -93,18 +97,19 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { computed, watch } from "vue";
|
|
|
+import { vInfiniteScroll } from "@vueuse/components";
|
|
|
+import { useThrottleFn } from "@vueuse/core";
|
|
|
import subHeader from "../components/subHeader";
|
|
|
import sideMenu from "../components/sideMenu";
|
|
|
import exhibitionBox from "../components/exhibitionBox";
|
|
|
import { useExhibitionStore } from "../store/exhibition";
|
|
|
import empty from "../components/empty.vue";
|
|
|
|
|
|
+const loadingBar = useLoadingBar();
|
|
|
const exhibitionStore = useExhibitionStore();
|
|
|
const domain = ref(import.meta.env.VITE_DOMAIN_URL);
|
|
|
const exhibitionList = computed(() => exhibitionStore.lists);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const XGap = ref(50);
|
|
|
const YGap = ref(50);
|
|
|
|
|
@@ -112,14 +117,24 @@ const currentTab = ref("all");
|
|
|
|
|
|
watch(
|
|
|
currentTab,
|
|
|
- (val) => {
|
|
|
+ async (val) => {
|
|
|
console.log("val", val);
|
|
|
- exhibitionStore.getExhibitionList(1, val);
|
|
|
+ loadingBar.start();
|
|
|
+ await exhibitionStore.getExhibitionList(1, val);
|
|
|
+ loadingBar.finish();
|
|
|
},
|
|
|
{
|
|
|
immediate: true,
|
|
|
}
|
|
|
);
|
|
|
+const onLoadMore = useThrottleFn(async () => {
|
|
|
+ if (exhibitionStore.isLoad) {
|
|
|
+ console.log("canLoadMore", exhibitionStore.canLoadMore);
|
|
|
+ exhibitionStore.canLoadMore && loadingBar.start();
|
|
|
+ await exhibitionStore.loadMore(currentTab.value);
|
|
|
+ loadingBar.finish();
|
|
|
+ }
|
|
|
+}, 1000);
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|