docs: Remove next tick cb in Home.vue

This commit is contained in:
Braks
2022-04-11 11:30:10 +02:00
parent c0c67c6ee6
commit 969dd87e71
+5 -12
View File
@@ -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>