fix(nodes): expand nodes correctly when prop enabled

This commit is contained in:
Braks
2022-04-04 21:42:48 +02:00
parent 266678d6a8
commit 4644af5736
2 changed files with 45 additions and 12 deletions
+16 -4
View File
@@ -74,10 +74,22 @@ const { onConnect, nodes, edges, addEdges, addNodes } = useVueFlow({
onConnect((params) => addEdges([params]))
onMounted(() => {
// dynamically add nodes to parent
addNodes([{ id: '999', type: 'input', label: 'Node 1', position: { x: 20, y: 100 }, class: 'light', extent: 'parent' }], {
parentNode: '2',
})
// add nodes to parent
addNodes(
[
{
id: '999',
type: 'input',
label: 'Added after mount',
position: { x: 20, y: 100 },
class: 'light',
expandParent: true,
},
],
{
parentNode: '2',
},
)
})
</script>
<template>