Skip to content

Commit

Permalink
fix: 连线缺失监听
Browse files Browse the repository at this point in the history
  • Loading branch information
xpyjs committed Jul 1, 2024
1 parent a2ac28b commit 8ece20a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/root/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 尺寸变化,表头和宽度需要重新渲染
Expand Down
9 changes: 5 additions & 4 deletions src/composables/useLinks.ts
Original file line number Diff line number Diff line change
@@ -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<LinkProps[]>) {
$links.init($data.flatData, links.value);

watchEffect(() => {
// 更新数据
$links.update($data.flatData, links);
$links.update($data.flatData, links.value);
});
}

Expand Down

0 comments on commit 8ece20a

Please sign in to comment.