Skip to content

Commit

Permalink
feat(button): add slots type (tusen-ai#6599)
Browse files Browse the repository at this point in the history
  • Loading branch information
nailiable committed Dec 7, 2024
1 parent 93fd985 commit 1ef779c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
7 changes: 7 additions & 0 deletions src/button/src/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
inject,
type PropType,
ref,
type SlotsType,
type VNodeChild,
watchEffect
} from 'vue'
Expand Down Expand Up @@ -95,9 +96,15 @@ export const buttonProps = {

export type ButtonProps = ExtractPublicPropTypes<typeof buttonProps>

export interface ButtonSlots {
default?: any
icon?: any
}

const Button = defineComponent({
name: 'Button',
props: buttonProps,
slots: Object as SlotsType<ButtonSlots>,
setup(props) {
if (__DEV__) {
watchEffect(() => {
Expand Down

0 comments on commit 1ef779c

Please sign in to comment.