2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2021-04-22 16:29:33 +03:00
|
|
|
<transition name="fade" mode="out-in">
|
|
|
|
<MkLoading v-if="fetching"/>
|
|
|
|
|
|
|
|
<MkError v-else-if="error" @retry="init()"/>
|
|
|
|
|
2021-11-19 12:36:12 +02:00
|
|
|
<div v-else-if="empty" key="_empty_" class="empty">
|
2021-12-23 09:10:13 +02:00
|
|
|
<slot name="empty">
|
|
|
|
<div class="_fullinfo">
|
|
|
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
|
|
|
<div>{{ $ts.nothing }}</div>
|
|
|
|
</div>
|
|
|
|
</slot>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2021-04-22 16:29:33 +03:00
|
|
|
|
|
|
|
<div v-else class="cxiknjgy">
|
|
|
|
<slot :items="items"></slot>
|
2021-11-19 12:36:12 +02:00
|
|
|
<div v-show="more" key="_more_" class="more _gap">
|
|
|
|
<MkButton v-appear="($store.state.enableInfiniteScroll && !disableAutoLoad) ? fetchMore : null" class="button" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }" primary @click="fetchMore">
|
2021-04-22 16:29:33 +03:00
|
|
|
<template v-if="!moreFetching">{{ $ts.loadMore }}</template>
|
|
|
|
<template v-if="moreFetching"><MkLoading inline/></template>
|
|
|
|
</MkButton>
|
|
|
|
</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2021-04-22 16:29:33 +03:00
|
|
|
</transition>
|
2020-01-29 21:37:25 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 14:12:00 +03:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 21:37:25 +02:00
|
|
|
import MkButton from './button.vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import paging from '@/scripts/paging';
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
export default defineComponent({
|
2020-01-29 21:37:25 +02:00
|
|
|
components: {
|
|
|
|
MkButton
|
|
|
|
},
|
|
|
|
|
2020-08-01 04:02:37 +03:00
|
|
|
mixins: [
|
|
|
|
paging({}),
|
|
|
|
],
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
props: {
|
|
|
|
pagination: {
|
|
|
|
required: true
|
|
|
|
},
|
2021-04-24 16:38:24 +03:00
|
|
|
|
|
|
|
disableAutoLoad: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-04-22 16:29:33 +03:00
|
|
|
.fade-enter-active,
|
|
|
|
.fade-leave-active {
|
|
|
|
transition: opacity 0.125s ease;
|
|
|
|
}
|
|
|
|
.fade-enter-from,
|
|
|
|
.fade-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
.cxiknjgy {
|
2020-02-11 19:52:37 +02:00
|
|
|
> .more > .button {
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
height: 48px;
|
|
|
|
min-width: 150px;
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
</style>
|