pref: optimize the timing of scrollbar reset
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
</div>
|
||||
|
||||
<ResponseScroll
|
||||
ref="responseScroll"
|
||||
:items="list"
|
||||
:itemSize="itemSize"
|
||||
:row-key="(item) => item.map(genModelKey).join(',')"
|
||||
@@ -80,7 +81,7 @@ import ModelCard from 'components/ModelCard.vue'
|
||||
import ResponseInput from 'components/ResponseInput.vue'
|
||||
import ResponseSelect from 'components/ResponseSelect.vue'
|
||||
import ResponseScroll from 'components/ResponseScroll.vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { chunk } from 'lodash'
|
||||
import { defineResizeCallback } from 'hooks/resize'
|
||||
@@ -91,6 +92,8 @@ const { isMobile, cardWidth, gutter, aspect, modelFolders } = useConfig()
|
||||
const { data } = useModels()
|
||||
const { t } = useI18n()
|
||||
|
||||
const responseScroll = ref()
|
||||
|
||||
const searchContent = ref<string>()
|
||||
|
||||
const currentType = ref('all')
|
||||
@@ -120,6 +123,10 @@ const sortOrderOptions = ref(
|
||||
}),
|
||||
)
|
||||
|
||||
watch([searchContent, currentType], () => {
|
||||
responseScroll.value.init()
|
||||
})
|
||||
|
||||
const itemSize = computed(() => {
|
||||
let itemWidth = cardWidth
|
||||
let itemGutter = gutter
|
||||
|
||||
@@ -298,7 +298,6 @@ const startDragThumb = (event: MouseEvent) => {
|
||||
watch(
|
||||
() => props.items,
|
||||
() => {
|
||||
init()
|
||||
setSpacerSize()
|
||||
calculateScrollThumbSize()
|
||||
calculateLoadItems()
|
||||
@@ -311,5 +310,6 @@ onUnmounted(() => {
|
||||
|
||||
defineExpose({
|
||||
viewport,
|
||||
init,
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user