From 07c67d2694439c2e4cddd97b0de113f64333089e Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Wed, 15 Oct 2025 19:43:32 +0800 Subject: [PATCH] fix --- src/shared/components/FlowchartEditor/useDnD.ts | 4 ++-- src/shared/components/FlowchartEditor/useFlowOperations.ts | 4 ++-- src/shared/components/MermaidEditor.vue | 5 ++--- src/shared/composables/useMermaid.ts | 4 ++-- src/utils/functions.ts | 5 +++++ 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/shared/components/FlowchartEditor/useDnD.ts b/src/shared/components/FlowchartEditor/useDnD.ts index 7fda135..f894f24 100644 --- a/src/shared/components/FlowchartEditor/useDnD.ts +++ b/src/shared/components/FlowchartEditor/useDnD.ts @@ -1,11 +1,11 @@ import { ref } from "vue" import { useVueFlow } from "@vue-flow/core" -import { nanoid } from "nanoid" import { getNodeTypeConfig, createNodeStyle, getNodeDimensions, } from "./useNodeStyles" +import { getRandomId } from "utils/functions" /** * 简化的拖拽处理 @@ -48,7 +48,7 @@ export function useDnD() { y: position.y - dimensions.height / 2, } - const nodeId = `node-${nanoid()}` + const nodeId = `node-${getRandomId()}` const config = getNodeTypeConfig(type) const newNode = { id: nodeId, diff --git a/src/shared/components/FlowchartEditor/useFlowOperations.ts b/src/shared/components/FlowchartEditor/useFlowOperations.ts index d5e6a1a..31abea2 100644 --- a/src/shared/components/FlowchartEditor/useFlowOperations.ts +++ b/src/shared/components/FlowchartEditor/useFlowOperations.ts @@ -1,6 +1,6 @@ -import { nanoid } from "nanoid" import type { Ref } from "vue" import type { Node, Edge } from "@vue-flow/core" +import { getRandomId } from "utils/functions" export function useFlowOperations( nodes: Ref, @@ -66,7 +66,7 @@ export function useFlowOperations( ) const newEdge: Edge = { - id: `edge-${nanoid()}`, + id: `edge-${getRandomId()}`, source: params.source, target: params.target, sourceHandle: params.sourceHandle, diff --git a/src/shared/components/MermaidEditor.vue b/src/shared/components/MermaidEditor.vue index c2abb2f..8b0bfc0 100644 --- a/src/shared/components/MermaidEditor.vue +++ b/src/shared/components/MermaidEditor.vue @@ -1,6 +1,5 @@