@vue-ui-kit/ant 1.7.0 → 1.7.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -393,7 +393,10 @@
393
393
  const resizeTable = () => {
394
394
  const pNode = boxEl.value?.parentElement;
395
395
  const ph = pNode ? window.getComputedStyle(pNode).height : '0px';
396
- const formHeight = pFormWrapper.value
396
+ const formOriginHeight = pFormWrapper.value
397
+ ? window.getComputedStyle(pFormWrapper.value).height
398
+ : '0px';
399
+ const formHeight = formOriginHeight.includes('px')
397
400
  ? toNumber(window.getComputedStyle(pFormWrapper.value).height.replace('px', ''))
398
401
  : 0;
399
402
 
@@ -424,13 +427,32 @@
424
427
  },
425
428
  resizeTable,
426
429
  });
430
+
431
+ let observer: MutationObserver;
427
432
  onMounted(() => {
428
433
  resizeTable();
429
434
  window.addEventListener('resize', resizeTable);
435
+ // 还需要在组件根节点由不可见转为可见时重新计算高度(display:none等样式控制时)
436
+ observer = new MutationObserver((mutations) => {
437
+ mutations.forEach((mutation) => {
438
+ if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
439
+ const el = mutation.target as HTMLElement;
440
+ const style = window.getComputedStyle(el);
441
+ if (style.display !== 'none') {
442
+ handlePageResize();
443
+ }
444
+ }
445
+ });
446
+ });
447
+
448
+ if (boxEl.value) {
449
+ observer.observe(boxEl.value, { attributes: true, attributeFilter: ['style'] });
450
+ }
430
451
  resetQueryFormData(props.manualFetch);
431
452
  });
432
453
  onBeforeUnmount(() => {
433
454
  window.removeEventListener('resize', resizeTable);
455
+ observer.disconnect();
434
456
  });
435
457
  </script>
436
458
  <template>