From 8ece20add6b1290a3f10f5495e326b5530f2b291 Mon Sep 17 00:00:00 2001 From: xpyjs Date: Mon, 1 Jul 2024 11:26:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=9E=E7=BA=BF=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #102 #108 --- src/components/root/index.vue | 4 ++-- src/composables/useLinks.ts | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/root/index.vue b/src/components/root/index.vue index ba92357..d503667 100644 --- a/src/components/root/index.vue +++ b/src/components/root/index.vue @@ -156,13 +156,13 @@ const { tableWidth } = useTableWidth(); // #endregion // #region 初始化各种数据 -const { data } = toRefs(props); +const { data, links } = toRefs(props); const { initData } = useData(); initData(data, props); const { initLinks } = useLinks(); -initLinks(props.links); +initLinks(links); // #endregion // #region 监听 gantt 尺寸变化,表头和宽度需要重新渲染 diff --git a/src/composables/useLinks.ts b/src/composables/useLinks.ts index 1b8c69c..1db1d5f 100644 --- a/src/composables/useLinks.ts +++ b/src/composables/useLinks.ts @@ -1,17 +1,18 @@ import type RowItem from '@/models/data/row'; import { useStore } from '@/store'; +import { type LinkProps } from '@/typings/link'; import { isBoolean } from 'lodash'; -import { watchEffect } from 'vue'; +import { type Ref, watchEffect } from 'vue'; export default () => { const { linking, $links, $data } = useStore(); - function initLinks(links: any[]) { - $links.init($data.flatData, links); + function initLinks(links: Ref) { + $links.init($data.flatData, links.value); watchEffect(() => { // 更新数据 - $links.update($data.flatData, links); + $links.update($data.flatData, links.value); }); }