docs: remove onPaneReady handler from Intro.vue
This commit is contained in:
@@ -41,7 +41,7 @@ const initialEdges = [
|
|||||||
style: { strokeWidth: 2, stroke: '#0ea5e9' },
|
style: { strokeWidth: 2, stroke: '#0ea5e9' },
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const { dimensions, instance, onNodeClick, onPaneReady, getNodes, getNode, getEdge, updateEdge, edges, setEdges } = useVueFlow({
|
const { dimensions, instance, onNodeClick, getNodes, getNode, getEdge, updateEdge, edges, setEdges } = useVueFlow({
|
||||||
nodes: [
|
nodes: [
|
||||||
{ id: 'intro', type: 'box', position: { x: 0, y: 0 } },
|
{ id: 'intro', type: 'box', position: { x: 0, y: 0 } },
|
||||||
{ id: 'examples', type: 'box', position: { x: -50, y: 400 } },
|
{ id: 'examples', type: 'box', position: { x: -50, y: 400 } },
|
||||||
@@ -103,7 +103,8 @@ onNodeClick(async ({ node }) => {
|
|||||||
const init = ref(false)
|
const init = ref(false)
|
||||||
const el = templateRef<HTMLDivElement>('el', null)
|
const el = templateRef<HTMLDivElement>('el', null)
|
||||||
|
|
||||||
onPaneReady(({ fitView }) => {
|
let stopObserver: () => void
|
||||||
|
|
||||||
const setNodes = () => {
|
const setNodes = () => {
|
||||||
if (breakpoints.isSmaller('md')) {
|
if (breakpoints.isSmaller('md')) {
|
||||||
const mainNode = getNode.value('intro')!
|
const mainNode = getNode.value('intro')!
|
||||||
@@ -191,13 +192,13 @@ onPaneReady(({ fitView }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
fitView()
|
instance.value?.fitView()
|
||||||
if (!init.value) init.value = true
|
if (!init.value) init.value = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
useResizeObserver(el, useDebounceFn(setNodes, 5))
|
const { stop } = useResizeObserver(el, useDebounceFn(setNodes, 5))
|
||||||
})
|
onBeforeUnmount(stop)
|
||||||
|
|
||||||
const scrollTo = () => {
|
const scrollTo = () => {
|
||||||
const el = document.getElementById('acknowledgement')
|
const el = document.getElementById('acknowledgement')
|
||||||
|
|||||||
Reference in New Issue
Block a user