From 1ef779c1ac9de16bd12a34d33a1078d1e39a8cc9 Mon Sep 17 00:00:00 2001 From: Naily Date: Sat, 7 Dec 2024 21:22:55 +0800 Subject: [PATCH] feat(button): add slots type (#6599) --- src/button/index.ts | 2 +- src/button/src/Button.tsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/button/index.ts b/src/button/index.ts index 6985a9ff9f5..0bb775f78b5 100644 --- a/src/button/index.ts +++ b/src/button/index.ts @@ -3,4 +3,4 @@ export { default as NButton, XButton as NxButton } from './src/Button' -export type { ButtonProps } from './src/Button' +export type { ButtonProps, ButtonSlots } from './src/Button' diff --git a/src/button/src/Button.tsx b/src/button/src/Button.tsx index 191c788ea32..06246048ae0 100644 --- a/src/button/src/Button.tsx +++ b/src/button/src/Button.tsx @@ -15,6 +15,7 @@ import { inject, type PropType, ref, + type SlotsType, type VNodeChild, watchEffect } from 'vue' @@ -95,9 +96,15 @@ export const buttonProps = { export type ButtonProps = ExtractPublicPropTypes +export interface ButtonSlots { + default?: any + icon?: any +} + const Button = defineComponent({ name: 'Button', props: buttonProps, + slots: Object as SlotsType, setup(props) { if (__DEV__) { watchEffect(() => {