@ditari/bsui 1.1.40 → 1.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@ import {
2
2
  computed,
3
3
  defineComponent,
4
4
  nextTick,
5
+ onBeforeUnmount,
6
+ onDeactivated,
5
7
  PropType,
6
8
  reactive,
7
9
  ref,
@@ -143,6 +145,7 @@ const DXTable = defineComponent({
143
145
  const antTableBodyRef = ref<any>(null);
144
146
  // 计算高度
145
147
  const playHeight = (height: number) => {
148
+ console.log("okk");
146
149
  try {
147
150
  const tableEl = tableRef?.value?.$el;
148
151
  const headerHeight = useEleHeight(
@@ -184,6 +187,8 @@ const DXTable = defineComponent({
184
187
  // });
185
188
  // }
186
189
  // });
190
+
191
+ let playTimeout: any = null;
187
192
  watch(
188
193
  () => props.height,
189
194
  (val) => {
@@ -193,15 +198,26 @@ const DXTable = defineComponent({
193
198
  playHeight(props.height);
194
199
  } else {
195
200
  // 必须在组件挂载成功后 执行计算高度 否则无法正确获取元素的高度
196
- setTimeout(() => {
201
+ playTimeout = setTimeout(() => {
197
202
  playHeight(props.height);
198
203
  // 如果表格头有很多列的情况下,获取到的头部高度不对,需要延迟执行获取高度方法
199
204
  }, 100);
200
205
  }
201
206
  });
202
207
  }
208
+ },
209
+ {
210
+ immediate: true
203
211
  }
204
212
  );
213
+
214
+ onBeforeUnmount(() => {
215
+ playTimeout && clearTimeout(playTimeout);
216
+ });
217
+ onDeactivated(() => {
218
+ playTimeout && clearTimeout(playTimeout);
219
+ });
220
+
205
221
  // 监听分页组件
206
222
  const onPageChange = (page: number, size: number) => {
207
223
  onChange ? onChange({ page: page === 0 ? 1 : page, size }) : null;
@@ -311,6 +327,9 @@ const DXTable = defineComponent({
311
327
  } else {
312
328
  rowSelection.value = undefined;
313
329
  }
330
+ },
331
+ {
332
+ immediate: true
314
333
  }
315
334
  );
316
335