update(examples): correct examples
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
<script lang="ts" setup>
|
||||
import { CSSProperties } from 'vue'
|
||||
// @ts-ignore
|
||||
import { Handle, NodeProps, Position } from '~/index'
|
||||
import { Handle, Position } from '~/index'
|
||||
import type { NodeProps } from '~/types/node'
|
||||
|
||||
interface CustomNodeProps extends NodeProps {
|
||||
id: string
|
||||
}
|
||||
const props = defineProps<CustomNodeProps>()
|
||||
const props = defineProps<NodeProps>()
|
||||
const nodeStyles: CSSProperties = { padding: '10px 15px', border: '1px solid #ddd' }
|
||||
</script>
|
||||
<template>
|
||||
<div :style="nodeStyles">
|
||||
<div :key="props.id" :style="nodeStyles">
|
||||
<div>node {{ props.id }}</div>
|
||||
<Handle id="left" type="source" :position="Position.Left" />
|
||||
<Handle id="right" type="source" :position="Position.Right" />
|
||||
|
||||
@@ -174,10 +174,7 @@ let id = 4
|
||||
const getId = () => `${id++}`
|
||||
|
||||
const elements = ref(initialElements)
|
||||
const onConnect = (params: Connection | Edge) => (elements.value = addEdge({ ...params, type: 'smoothstep' }, elements.value))
|
||||
const { project } = useZoomPanHelper()
|
||||
const onEdgeUpdate = (oldEdge: Edge, newConnection: Connection) =>
|
||||
(elements.value = updateEdge(oldEdge, newConnection, elements.value))
|
||||
|
||||
const onPaneClick = (evt: MouseEvent) =>
|
||||
(elements.value = elements.value.concat({
|
||||
@@ -189,12 +186,9 @@ const onPaneClick = (evt: MouseEvent) =>
|
||||
<template>
|
||||
<VueFlow
|
||||
v-model="elements"
|
||||
:node-types="['custom']"
|
||||
:connection-line-type="ConnectionLineType.SmoothStep"
|
||||
:connection-mode="ConnectionMode.Loose"
|
||||
@connect="onConnect"
|
||||
@pane-click="onPaneClick"
|
||||
@edge-pdate="onEdgeUpdate"
|
||||
>
|
||||
<template #node-custom="props">
|
||||
<CustomNode v-bind="props" />
|
||||
|
||||
Reference in New Issue
Block a user