update(examples): remove watchEffect from UpdateNodeExample.vue
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> update(examples): fix style calculation in CustomNode.vue Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -29,23 +29,20 @@ const updateNode = () => {
|
||||
return el
|
||||
})
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
updateNode()
|
||||
})
|
||||
onMounted(updateNode)
|
||||
</script>
|
||||
<template>
|
||||
<VueFlow v-model="elements" :default-zoom="1.5" :min-zoom="0.2" :max-zoom="4">
|
||||
<div class="updatenode__controls">
|
||||
<label>label:</label>
|
||||
<input v-model="nodeName" />
|
||||
<input v-model="nodeName" @input="updateNode" />
|
||||
|
||||
<label class="updatenode__bglabel">background:</label>
|
||||
<input v-model="nodeBg" type="color" />
|
||||
<input v-model="nodeBg" type="color" @input="updateNode" />
|
||||
|
||||
<div class="updatenode__checkboxwrapper">
|
||||
<label>hidden:</label>
|
||||
<input v-model="nodeHidden" type="checkbox" />
|
||||
<input v-model="nodeHidden" type="checkbox" @input="updateNode" />
|
||||
</div>
|
||||
</div>
|
||||
</VueFlow>
|
||||
|
||||
@@ -22,7 +22,7 @@ const props = defineProps<CustomNodeProps>()
|
||||
:key="`handle-${i}`"
|
||||
type="source"
|
||||
:position="Position.Right"
|
||||
:style="{ top: 10 * i + props.data.handlePosition * 10 }"
|
||||
:style="{ top: `${10 * i + props.data.handlePosition * 10}px` }"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -47,10 +47,7 @@ const onPaneClick = (evt: MouseEvent) =>
|
||||
|
||||
const toggleHandleCount = () =>
|
||||
(elements.value = elements.value.map((el) => {
|
||||
if (isEdge(el)) {
|
||||
return el
|
||||
}
|
||||
|
||||
if (isEdge(el)) return el
|
||||
return { ...el, data: { ...el.data, handleCount: el.data?.handleCount === 1 ? 2 : 1 } }
|
||||
}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user