working on server list

This commit is contained in:
2023-05-05 19:23:46 +02:00
parent c2227bffff
commit 933f421313
19 changed files with 100 additions and 29 deletions
+9 -2
View File
@@ -23,7 +23,7 @@ export default defineComponent({
data () {
return {
toLoad: 10,
vlistHeight: 0,
vlistHeight: 10,
vIndex: 0
}
},
@@ -33,7 +33,14 @@ export default defineComponent({
highlighted: String
},
emits: ['highlightPlayer'],
mounted () {
if (this.$props.list) {
this.vlistHeight = (this.$refs.vlist as HTMLElement)?.getBoundingClientRect().height || 0
if (this.$props.highlighted) {
setTimeout(() => (this.$refs.vlist as HTMLElement)?.scrollBy({ top: ((this.list.findIndex(e => e.id === this.$props.highlighted)) * this.rowHeight) - ((this.$refs.vlist as HTMLElement))?.scrollTop - (this.vlistHeight / 2 - this.$props.rowHeight), behavior: 'smooth' }), 1)
}
}
},
computed: {
visibleList () {
return this.list.slice(Math.max(this.vIndex, 0), Math.min(this.vIndex + this.visibleCount * 3, this.list.length))