Add midjourney pagination (#172)

This commit is contained in:
HCode authored and GitHub committed 2025-02-10 02:32:36 +08:00
1 parent 49b2a5846c
commit 31fc4b4472
10 files changed
+137 -32

No files matched your search

+12 -2
View File
@@ -21,7 +21,7 @@
<div v-else-if="tasks && tasks?.length === 0">
<p class="p-5 description">{{ $t('midjourney.message.noTasks') }}</p>
</div>
<div v-else-if="tasks.length > 0" class="tasks">
<div v-else-if="tasks.length > 0" ref="panel" class="tasks" @scroll="onHandleScroll">
<div v-for="(task, taskKey) in tasks" :key="taskKey" class="task">
<task-item :full="false" :model-value="task" @custom="$emit('custom', $event)" />
</div>
@@ -41,7 +41,7 @@ export default defineComponent({
ElSkeleton,
ElSkeletonItem
},
emits: ['update:modelValue', 'custom', 'refresh'],
emits: ['update:modelValue', 'custom', 'refresh', 'reach-top'],
data() {
return {
job: 0
@@ -55,6 +55,16 @@ export default defineComponent({
application() {
return this.$store.state.midjourney.application;
}
},
methods: {
onHandleScroll() {
const el = this.$refs.panel as HTMLElement;
console.log('onHandleScroll ', el.scrollTop);
if (el.scrollTop === 0) {
console.log('reach-top reach-top');
this.$emit('reach-top');
}
}
}
});
</script>
+1
View File
@@ -66,6 +66,7 @@ export default defineComponent({
methods: {
onHandleScroll() {
const el = this.$refs.panel as HTMLElement;
console.log('reach-top reach-top reach-top');
if (el.scrollTop === 0) {
this.$emit('reach-top');
}