Skip to content

Commit 4f3bea7

Browse files
committed
feat(doc): remove auto load more
1 parent c8d43d8 commit 4f3bea7

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/locale/en-us.js

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const mEnUS = {
3232
Author: 'Author',
3333
AccessDenied: 'Access Denied',
3434
InputKeywords: 'Fuzzy Search',
35+
LoadMore: 'Load More',
3536
};
3637

3738
export default mEnUS;

src/locale/zh-cn.js

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const mZhCN = {
3232
Author: '作者',
3333
AccessDenied: '未经授权访问',
3434
InputKeywords: '关键字搜索',
35+
LoadMore: '加载更多',
3536
};
3637

3738
export default mZhCN;

src/views/Home.vue

+13-14
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,10 @@ onMounted(() => window.addEventListener('resize', () => handleResize()));
113113
onUnmounted(() => window.removeEventListener('resize', () => {}));
114114
115115
// load more
116-
const container = document.getElementById('app-content-scroll');
117116
const loadMore = () => {
118-
if (
119-
(container.scrollTop + container.clientHeight === container.scrollHeight) &&
120-
(searchData.value.total > searchData.value.current * searchData.value.size)
121-
) {
122-
searchData.value.current += 1;
123-
loadDocs(true);
124-
}
117+
searchData.value.current += 1;
118+
loadDocs(true);
125119
};
126-
onMounted(() => {
127-
container.addEventListener('scroll', () => loadMore());
128-
});
129-
onUnmounted(() => {
130-
container.removeEventListener('scroll', () => {});
131-
});
132120
</script>
133121

134122
<template>
@@ -204,6 +192,17 @@ onUnmounted(() => {
204192
</a-col>
205193
</a-row>
206194
</a-spin>
195+
<div
196+
style="width: 100%; display: flex; justify-content: center; margin-top: 20px;"
197+
v-if="!docLoading && (searchData.total > searchData.current * searchData.size)"
198+
>
199+
<a-link @click="loadMore">
200+
<div style="display: flex; flex-direction: column; align-items: center">
201+
<div>{{ $t('LoadMore') }}</div>
202+
<icon-down style="font-size: 14px" />
203+
</div>
204+
</a-link>
205+
</div>
207206
<skeleton
208207
v-show="(docAppendLoading && docs.length) || (!docLoading && !docs.length)"
209208
:animation="docAppendLoading"

0 commit comments

Comments
 (0)