node
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="node start" :class="{ center: posCenter }">
|
<div class="node start" :class="{ center: posCenter }">
|
||||||
<template v-if="type === NODE_TYPE.INPUT">
|
<Handle
|
||||||
<Handle type="source" id="Right" :position="Position.Right" />
|
v-for="handle in handles[type]"
|
||||||
</template>
|
:key="handle.id"
|
||||||
<template v-else-if="type === NODE_TYPE.SECONDARY">
|
:type="handle.type"
|
||||||
<Handle type="target" id="Left" :position="Position.Left" />
|
:id="handle.id"
|
||||||
<Handle type="source" id="Right" :position="Position.Right" />
|
:position="handle.position"
|
||||||
</template>
|
:connectable="false"
|
||||||
<template v-else-if="type === NODE_TYPE.OUTPUT">
|
/>
|
||||||
<Handle type="target" id="Left" :position="Position.Left" />
|
|
||||||
</template>
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
@@ -22,7 +20,15 @@
|
|||||||
import { Handle, Position } from '@vue-flow/core'
|
import { Handle, Position } from '@vue-flow/core'
|
||||||
import { NODE_TYPE } from '../tools/index.d'
|
import { NODE_TYPE } from '../tools/index.d'
|
||||||
import { NODE_DATATYPE, NODE_DATATIER } from '../tools/index.d'
|
import { NODE_DATATYPE, NODE_DATATIER } from '../tools/index.d'
|
||||||
import { computed } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
const handles = ref({
|
||||||
|
[NODE_TYPE.INPUT]: [{ id: 'Right', type: 'source', position: Position.Right }],
|
||||||
|
[NODE_TYPE.SECONDARY]: [
|
||||||
|
{ id: 'Left', type: 'target', position: Position.Left },
|
||||||
|
{ id: 'Right', type: 'source', position: Position.Right }
|
||||||
|
],
|
||||||
|
[NODE_TYPE.OUTPUT]: [{ id: 'Left', type: 'target', position: Position.Left }]
|
||||||
|
})
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user