docs: use debounce for fitviews
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch } from 'vue'
|
|
||||||
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
|
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'
|
||||||
import type { VueFlowStore } from '@braks/vue-flow'
|
import type { VueFlowStore } from '@braks/vue-flow'
|
||||||
|
|
||||||
@@ -16,11 +15,9 @@ const fitViews = () => {
|
|||||||
instances.forEach((i) => i.fitView())
|
instances.forEach((i) => i.fitView())
|
||||||
}
|
}
|
||||||
|
|
||||||
watch([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], () =>
|
watchDebounced([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], () => fitViews(), {
|
||||||
setTimeout(() => {
|
debounce: 50,
|
||||||
fitViews()
|
})
|
||||||
}, 5),
|
|
||||||
)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user