Initial project
This commit is contained in:
44
src/views/index/RepositoryLog.vue
Normal file
44
src/views/index/RepositoryLog.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="repository-log">
|
||||
<push-log-timeline :items="list"/>
|
||||
<div class="bottom">
|
||||
<loading :showOn="isLoading"/>
|
||||
<empty-tips :showOn="isFinished && !isLoading"/>
|
||||
<t-button v-show="!isFinished && !isLoading" @click="doFetchEvent">加载更多</t-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import RepositoryAPI from "@/api/RepositoryAPI";
|
||||
import { EmptyTips, Loading, Page } from "timi-web";
|
||||
import { ActionLogView } from "@/types/Common.ts";
|
||||
import PushLogTimeline from "@/components/PushLogTimeline.vue";
|
||||
|
||||
const page = ref<Page>({
|
||||
index: 0,
|
||||
size: 12
|
||||
});
|
||||
const list = reactive<ActionLogView[]>([]);
|
||||
const isFinished = ref(false);
|
||||
const isLoading = ref(true);
|
||||
|
||||
const doFetchEvent = async () => {
|
||||
isLoading.value = true;
|
||||
|
||||
const result = await RepositoryAPI.pageLog(page.value);
|
||||
list.push(...result.list);
|
||||
page.value.index++;
|
||||
if (result.list.length < page.value.size) {
|
||||
isFinished.value = true;
|
||||
}
|
||||
isLoading.value = false;
|
||||
};
|
||||
|
||||
onMounted(doFetchEvent);
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.repository-log {
|
||||
width: 100%;
|
||||
padding: 1rem 2rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user