diff --git a/src/components/viewPost/vp-overlay-follow.vue b/src/components/viewPost/vp-overlay-follow.vue
index 103af751..10be6831 100644
--- a/src/components/viewPost/vp-overlay-follow.vue
+++ b/src/components/viewPost/vp-overlay-follow.vue
@@ -10,9 +10,8 @@
刷新
- 加载更多
-
+
("listRef");
+const { isReachBottom } = useBoxReachBottom(listEl);
+
const visible = defineModel();
+
const offset = ref();
const isLast = ref(false);
const loading = ref(false);
const posts = shallowRef>([]);
+watch(
+ () => isReachBottom.value,
+ async () => {
+ if (!isReachBottom.value) return;
+ await loadMore();
+ },
+);
watch(
() => visible.value,
async () => {
@@ -71,6 +83,9 @@ async function loadMore(refresh: boolean = false): Promise {
else posts.value = posts.value.concat(resp.list);
loading.value = false;
showSnackbar.success(`成功加载${resp.list.length}条数据`);
+ if (refresh && listEl.value) {
+ listEl.value.scrollTo({ top: 0, behavior: "smooth" });
+ }
}
diff --git a/src/components/viewPost/vp-overlay-user.vue b/src/components/viewPost/vp-overlay-user.vue
index acbb8507..f101ad10 100644
--- a/src/components/viewPost/vp-overlay-user.vue
+++ b/src/components/viewPost/vp-overlay-user.vue
@@ -21,16 +21,13 @@
-
- 加载更多({{ results.length }})
-
-
+
("listRef");
+const { isReachBottom } = useBoxReachBottom(listEl);
+
const props = defineProps();
const visible = defineModel();
const offset = ref();
@@ -69,6 +70,13 @@ const levelColor = computed(() => {
return "var(--tgc-od-white)";
});
+watch(
+ () => isReachBottom.value,
+ async () => {
+ if (!isReachBottom.value) return;
+ await loadPosts();
+ },
+);
watch(
() => visible.value,
async () => {
@@ -117,6 +125,7 @@ async function loadPosts(): Promise {
isLast.value = resp.is_last;
results.value = results.value.concat(resp.list);
load.value = false;
+ showSnackbar.success(`成功加载${resp.list.length}条数据`);
}