2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2021-04-22 06:29:33 -07:00
|
|
|
<transition name="fade" mode="out-in">
|
|
|
|
<MkLoading v-if="fetching"/>
|
|
|
|
|
|
|
|
<MkError v-else-if="error" @retry="init()"/>
|
|
|
|
|
2021-11-19 02:36:12 -08:00
|
|
|
<div v-else-if="empty" key="_empty_" class="empty">
|
2020-01-29 11:37:25 -08:00
|
|
|
<slot name="empty"></slot>
|
|
|
|
</div>
|
2021-04-22 06:29:33 -07:00
|
|
|
|
|
|
|
<div v-else class="cxiknjgy">
|
|
|
|
<slot :items="items"></slot>
|
2021-11-19 02:36:12 -08: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 06:29:33 -07:00
|
|
|
<template v-if="!moreFetching">{{ $ts.loadMore }}</template>
|
|
|
|
<template v-if="moreFetching"><MkLoading inline/></template>
|
|
|
|
</MkButton>
|
|
|
|
</div>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
2021-04-22 06:29:33 -07:00
|
|
|
</transition>
|
2020-01-29 11:37:25 -08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 04:12:00 -07:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 11:37:25 -08:00
|
|
|
import MkButton from './button.vue';
|
2021-11-11 09:02:25 -08:00
|
|
|
import paging from '@/scripts/paging';
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2020-10-17 04:12:00 -07:00
|
|
|
export default defineComponent({
|
2020-01-29 11:37:25 -08:00
|
|
|
components: {
|
|
|
|
MkButton
|
|
|
|
},
|
|
|
|
|
2020-07-31 18:02:37 -07:00
|
|
|
mixins: [
|
|
|
|
paging({}),
|
|
|
|
],
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
props: {
|
|
|
|
pagination: {
|
|
|
|
required: true
|
|
|
|
},
|
2021-04-24 06:38:24 -07:00
|
|
|
|
|
|
|
disableAutoLoad: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-04-22 06:29:33 -07:00
|
|
|
.fade-enter-active,
|
|
|
|
.fade-leave-active {
|
|
|
|
transition: opacity 0.125s ease;
|
|
|
|
}
|
|
|
|
.fade-enter-from,
|
|
|
|
.fade-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
.cxiknjgy {
|
2020-02-11 09:52:37 -08:00
|
|
|
> .more > .button {
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
height: 48px;
|
|
|
|
min-width: 150px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
</style>
|