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