feat(naive-ui): 添加 Modal 命令式 API 支持并完善类型声明
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 2m10s
CI/CD Pipeline / build-and-deploy (push) Successful in 4m16s

This commit is contained in:
严浩
2025-10-30 14:18:06 +08:00
parent 21676c11ff
commit 5b54fe5182
2 changed files with 39 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ const themeOverrides: GlobalThemeOverrides = {
const ContextHolder: FunctionalComponent = () => {
window.$nLoadingBar = useLoadingBar();
window.$nModal = useModal();
window.$nDialog = useDialog();
window.$nMessage = useMessage();
window.$nNotification = useNotification();
@@ -24,6 +25,7 @@ const ContextHolder: FunctionalComponent = () => {
declare global {
export interface Window {
$nLoadingBar?: import('naive-ui').LoadingBarProviderInst;
$nModal?: import('naive-ui').ModalProviderInst;
$nDialog?: import('naive-ui').DialogProviderInst;
$nMessage?: import('naive-ui').MessageProviderInst;
$nNotification?: import('naive-ui').NotificationProviderInst;
@@ -41,15 +43,17 @@ declare global {
:theme="appStore.isDark ? darkTheme : null"
abstract
>
<NLoadingBarProvider>
<NDialogProvider>
<NNotificationProvider>
<NMessageProvider>
<ContextHolder />
<slot></slot>
</NMessageProvider>
</NNotificationProvider>
</NDialogProvider>
</NLoadingBarProvider>
<n-loading-bar-provider>
<n-message-provider>
<n-notification-provider>
<n-modal-provider>
<n-dialog-provider>
<slot></slot>
<ContextHolder />
</n-dialog-provider>
</n-modal-provider>
</n-notification-provider>
</n-message-provider>
</n-loading-bar-provider>
</NConfigProvider>
</template>