chore: remove some logs
fix: inject store instance to handle component
This commit is contained in:
@@ -50,7 +50,6 @@ const DnDFlow = defineComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
elements.value.push(newNode);
|
elements.value.push(newNode);
|
||||||
console.log(elements.value);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Connection, ElementId, Position } from '../../types';
|
import { Connection, ElementId, Position, RevueFlowStore } from '../../types';
|
||||||
import { onMouseDown, ValidConnectionFunc } from './handler';
|
import { onMouseDown, ValidConnectionFunc } from './handler';
|
||||||
import { computed, defineComponent, inject, PropType } from 'vue';
|
import { computed, defineComponent, inject, PropType } from 'vue';
|
||||||
import store from '../../store';
|
|
||||||
|
|
||||||
const alwaysValid = () => true;
|
const alwaysValid = () => true;
|
||||||
|
|
||||||
@@ -39,10 +38,10 @@ const Handle = defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props, { slots }) {
|
setup(props, { slots }) {
|
||||||
const pinia = store();
|
const store = inject<RevueFlowStore>('store')!;
|
||||||
const nodeId = inject<ElementId>('NodeIdContext') as ElementId;
|
const nodeId = inject<ElementId>('NodeIdContext') as ElementId;
|
||||||
const isTarget = computed(() => props.type === 'target');
|
const isTarget = computed(() => props.type === 'target');
|
||||||
const onConnect = computed(() => pinia.onConnect);
|
const onConnect = computed(() => store.onConnect);
|
||||||
|
|
||||||
const onConnectExtended = (params: Connection) => {
|
const onConnectExtended = (params: Connection) => {
|
||||||
onConnect.value?.(params);
|
onConnect.value?.(params);
|
||||||
@@ -54,17 +53,17 @@ const Handle = defineComponent({
|
|||||||
event,
|
event,
|
||||||
props.id as string,
|
props.id as string,
|
||||||
nodeId,
|
nodeId,
|
||||||
pinia.setConnectionNodeId,
|
store.setConnectionNodeId,
|
||||||
pinia.setConnectionPosition,
|
store.setConnectionPosition,
|
||||||
onConnectExtended,
|
onConnectExtended,
|
||||||
isTarget.value,
|
isTarget.value,
|
||||||
props.isValidConnection,
|
props.isValidConnection,
|
||||||
pinia.connectionMode,
|
store.connectionMode,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
pinia.onConnectStart,
|
store.onConnectStart,
|
||||||
pinia.onConnectStop,
|
store.onConnectStop,
|
||||||
pinia.onConnectEnd
|
store.onConnectEnd
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user