diff --git a/src/types/views.d.ts b/src/types/views.d.ts index a44eb04..9e97f77 100644 --- a/src/types/views.d.ts +++ b/src/types/views.d.ts @@ -242,8 +242,6 @@ declare type XyState = { }; declare type WorkflowState = { - workflowRightRef: HTMLDivElement | null; - leftNavRefs: HTMLElement[]; leftNavList: T[]; dropdownNode: XyState; dropdownLine: XyState; diff --git a/src/views/pages/workflow/index.vue b/src/views/pages/workflow/index.vue index f93a193..b217141 100644 --- a/src/views/pages/workflow/index.vue +++ b/src/views/pages/workflow/index.vue @@ -12,7 +12,7 @@
import('./component/drawer/index.vue') const Help = defineAsyncComponent(() => import('./component/tool/help.vue')); // 定义变量内容 +const leftNavRefs = ref([]); +const workflowRightRef = ref(); const contextmenuNodeRef = ref(); const contextmenuLineRef = ref(); const drawerRef = ref(); @@ -95,8 +97,6 @@ const storesThemeConfig = useThemeConfig(); const { themeConfig } = storeToRefs(storesThemeConfig); const { copyText } = commonFunction(); const state = reactive({ - workflowRightRef: null, - leftNavRefs: [], leftNavList: [], dropdownNode: { x: '', y: '' }, dropdownLine: { x: '', y: '' }, @@ -151,7 +151,7 @@ const initLeftNavList = () => { }; // 左侧导航-初始化拖动 const initSortable = () => { - state.leftNavRefs.forEach((v) => { + leftNavRefs.forEach((v) => { Sortable.create(v as HTMLDivElement, { group: { name: 'vue-next-admin-1', @@ -165,7 +165,7 @@ const initSortable = () => { onEnd: function (evt: any) { const { name, icon, id } = evt.clone.dataset; const { layerX, layerY, clientX, clientY } = evt.originalEvent; - const el = state.workflowRightRef!; + const el = workflowRightRef.value!; const { x, y, width, height } = el.getBoundingClientRect(); if (clientX < x || clientX > width + x || clientY < y || y > y + height) { ElMessage.warning('请把节点拖入到画布中');