45 lines
1.1 KiB
Vue
45 lines
1.1 KiB
Vue
<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: calc(100% - 4rem);
|
|
padding: 1rem 2rem;
|
|
}
|
|
</style>
|