Skip to content

Commit

Permalink
feat(switch): 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 be2d9d5 commit 7dd15f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/switch/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as NSwitch, switchProps } from './src/Switch'
export type { SwitchProps } from './src/Switch'
export type { SwitchProps, SwitchSlots } from './src/Switch'
11 changes: 11 additions & 0 deletions src/switch/src/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
h,
type PropType,
ref,
type SlotsType,
toRef,
watchEffect
} from 'vue'
Expand Down Expand Up @@ -74,11 +75,21 @@ export const switchProps = {

export type SwitchProps = ExtractPublicPropTypes<typeof switchProps>

export interface SwitchSlots {
default?: any
checked?: any
'checked-icon'?: any
icon?: any
unchecked?: any
'unchecked-icon'?: any
}

let supportCssMax: boolean | undefined

export default defineComponent({
name: 'Switch',
props: switchProps,
slots: Object as SlotsType<SwitchSlots>,
setup(props) {
if (__DEV__) {
watchEffect(() => {
Expand Down

0 comments on commit 7dd15f0

Please sign in to comment.