docs: Remove next tick cb in Home.vue
This commit is contained in:
@@ -66,15 +66,11 @@ const init = ref(false)
|
||||
const edgeId = ref('eintro-documentation')
|
||||
onPaneReady(({ fitView }) => {
|
||||
fitView({
|
||||
nodes: ['intro', 'examples', 'documentation'],
|
||||
duration: 1500,
|
||||
})
|
||||
|
||||
watch(
|
||||
[breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']],
|
||||
() => {
|
||||
const setNodes = () => {
|
||||
if (breakpoints.isSmaller('md')) {
|
||||
nextTick(() => {
|
||||
getNodes.value.forEach((node) => {
|
||||
switch (node.id) {
|
||||
case 'intro':
|
||||
@@ -96,9 +92,7 @@ onPaneReady(({ fitView }) => {
|
||||
targetHandle: null,
|
||||
})
|
||||
if (newEdge) edgeId.value = newEdge.id
|
||||
})
|
||||
} else {
|
||||
nextTick(() => {
|
||||
getNodes.value.forEach((node) => {
|
||||
switch (node.id) {
|
||||
case 'intro':
|
||||
@@ -120,19 +114,18 @@ onPaneReady(({ fitView }) => {
|
||||
targetHandle: null,
|
||||
})
|
||||
if (newEdge) edgeId.value = newEdge.id
|
||||
})
|
||||
}
|
||||
|
||||
setTimeout(
|
||||
() => {
|
||||
if (!init.value) init.value = true
|
||||
instance.value?.fitView()
|
||||
else instance.value?.fitView()
|
||||
},
|
||||
init.value ? 5 : 1505,
|
||||
)
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
}
|
||||
|
||||
watch([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], setNodes, { immediate: true })
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user