ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

getPopupContainer,类型错误

Open soluationsign opened this issue 6 months ago • 0 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

"vue": "^3.5.13","ant-design-vue": "^4.2.6",

Reproduction link

Edit on CodeSandbox

Steps to reproduce

a-config-provider配置getPopupContainer的类型推断存在问题

What is expected?

可以正确定义getPopupContainer属性的参数类型

What is actually happening?

<script setup lang="ts">
import zhCn from "ant-design-vue/es/locale/zh_CN";

const getPopupContainer: any = (_: any, dialogContext: any) => {
if (dialogContext) {
return dialogContext.getDialogWrap();
} else {
return document.body;
}
};
</script>

<template>
<a-config-provider :getPopupContainer="getPopupContainer" :locale="zhCn">
<router-view />
</a-config-provider>
</template>

getPopupContainer属性的类型推断是(property) getPopupContainer?: ((triggerNode?: HTMLElement) => HTMLElement) | undefined,ant-design-vue已更新至最新版本4.2.6,但根据官网的https://www.antdv.com/components/config-provider-cn配置应该还存在dialogContext参数,所以我定义了any,希望可以正确推断getPopupContainer的参数类型

soluationsign avatar May 06 '25 01:05 soluationsign