feat: sketch自动滚动到底部

This commit is contained in:
2026-04-14 09:34:33 +08:00
parent 8806fbeb49
commit 1301fd3825
2 changed files with 15 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
<template>
<div
ref="containerRef"
class="preview-container flex"
:class="type === 'sketch' ? 'sketch-preview' : 'report-preview'"
>
@@ -93,7 +94,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted, watch, computed } from 'vue'
import { ref, reactive, onMounted, onUnmounted, watch, computed, nextTick } from 'vue'
import { deleteSketchFlowCanvas } from '@/api/flow-canvas'
import { useProjectStore } from '@/stores'
import { useI18n } from 'vue-i18n'
@@ -114,6 +115,7 @@
// 存储每个图片的加载状态
const loadedStatus = ref<boolean[]>([])
const containerRef = ref<HTMLElement>()
const props = withDefaults(
defineProps<{
@@ -131,7 +133,12 @@
() => {
// 当 sketchList 变化时,重置加载状态
loadedStatus.value = new Array(combineSketchList.value.length).fill(false)
// pendingSketchIndexes.value = []
// 当 type 为 sketch 时,自动滚动到最底部
if (props.type === 'sketch') {
nextTick(() => {
containerRef.value?.scrollTo({ top: containerRef.value.scrollHeight, behavior: 'smooth' })
})
}
}
)