2020-01-29 13:37:25 -06:00
|
|
|
<template>
|
2021-04-22 08:29:33 -05:00
|
|
|
<transition name="fade" mode="out-in">
|
|
|
|
<MkLoading v-if="fetching"/>
|
|
|
|
|
|
|
|
<MkError v-else-if="error" @retry="init()"/>
|
|
|
|
|
|
|
|
<div class="empty" v-else-if="empty" key="_empty_">
|
2020-01-29 13:37:25 -06:00
|
|
|
<slot name="empty"></slot>
|
|
|
|
</div>
|
2021-04-22 08:29:33 -05:00
|
|
|
|
|
|
|
<div v-else class="cxiknjgy">
|
|
|
|
<slot :items="items"></slot>
|
|
|
|
<div class="more" v-show="more" key="_more_">
|
|
|
|
<MkButton class="button" v-appear="$store.state.enableInfiniteScroll ? fetchMore : null" @click="fetchMore" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }" primary>
|
|
|
|
<template v-if="!moreFetching">{{ $ts.loadMore }}</template>
|
|
|
|
<template v-if="moreFetching"><MkLoading inline/></template>
|
|
|
|
</MkButton>
|
|
|
|
</div>
|
2020-01-29 13:37:25 -06:00
|
|
|
</div>
|
2021-04-22 08:29:33 -05:00
|
|
|
</transition>
|
2020-01-29 13:37:25 -06:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 06:12:00 -05:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 13:37:25 -06:00
|
|
|
import MkButton from './button.vue';
|
2021-03-23 03:30:14 -05:00
|
|
|
import paging from '@client/scripts/paging';
|
2020-01-29 13:37:25 -06:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2020-01-29 13:37:25 -06:00
|
|
|
components: {
|
|
|
|
MkButton
|
|
|
|
},
|
|
|
|
|
2020-07-31 20:02:37 -05:00
|
|
|
mixins: [
|
|
|
|
paging({}),
|
|
|
|
],
|
|
|
|
|
2020-01-29 13:37:25 -06:00
|
|
|
props: {
|
|
|
|
pagination: {
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-04-22 08:29:33 -05:00
|
|
|
.fade-enter-active,
|
|
|
|
.fade-leave-active {
|
|
|
|
transition: opacity 0.125s ease;
|
|
|
|
}
|
|
|
|
.fade-enter-from,
|
|
|
|
.fade-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2020-01-29 13:37:25 -06:00
|
|
|
.cxiknjgy {
|
2020-02-11 11:52:37 -06:00
|
|
|
> .more > .button {
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
height: 48px;
|
|
|
|
min-width: 150px;
|
|
|
|
}
|
2020-01-29 13:37:25 -06:00
|
|
|
}
|
|
|
|
</style>
|