File tree 1 file changed +7
-1
lines changed
packages/applet/src/components/timeline
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import type { TimelineEventOptions } from ' @vue/devtools-kit'
3
- import { computed } from ' vue'
3
+ import { computed , ref , watch } from ' vue'
4
4
import { RecycleScroller } from ' vue-virtual-scroller'
5
5
import { formatTime } from ' ~/utils'
6
6
import ' vue-virtual-scroller/dist/vue-virtual-scroller.css'
@@ -11,6 +11,7 @@ const props = defineProps<{
11
11
12
12
const selected = defineModel ()
13
13
const colors = [' #3e5770' , ' #42b983' , ' #0098c4' ]
14
+ const scrollerRef = ref <InstanceType <typeof RecycleScroller > | null >(null )
14
15
15
16
const normalizedData = computed (() => {
16
17
let currentColorIndex = - 1
@@ -26,11 +27,16 @@ const normalizedData = computed(() => {
26
27
})
27
28
return props .data
28
29
})
30
+
31
+ watch (() => normalizedData .value .length , (length ) => {
32
+ scrollerRef .value ?.scrollToItem (length - 1 )
33
+ }, { flush: ' post' })
29
34
</script >
30
35
31
36
<template >
32
37
<div class =" p3" >
33
38
<RecycleScroller
39
+ ref =" scrollerRef"
34
40
v-slot =" { item }"
35
41
:items =" normalizedData"
36
42
:min-item-size =" 52"
You can’t perform that action at this time.
0 commit comments