Skip to content

Commit

Permalink
refactor(types): 优化通用类型
Browse files Browse the repository at this point in the history
  • Loading branch information
Ce1ling committed Oct 3, 2023
1 parent 7063b81 commit c5920b3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/components/Button/button.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ViBaseSizes, ViBaseTypes } from '../types'

export interface ButtonProps {
type?: 'primary' | 'success' | 'info' | 'warning' | 'danger'
type?: ViBaseTypes
text?: boolean
round?: boolean
circle?: boolean
Expand All @@ -9,7 +11,7 @@ export interface ButtonProps {
bgColor?: string
color?: string
plain?: boolean
size?: 'small' | 'normal' | 'large'
size?: ViBaseSizes
disableShadow?: boolean
}

Expand Down
6 changes: 4 additions & 2 deletions packages/components/Link/link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ViBaseTypes } from '../types'

export interface LinkProps {
type?: 'primary' | 'success' | 'warning' | 'danger'
type?: Omit<ViBaseTypes, 'info'>
disabled?: boolean
underline?: boolean
}
Expand All @@ -12,4 +14,4 @@ export interface LinkSlots {
default?: (props: {}) => any
prefix?: (props: {}) => any
suffix?: (props: {}) => any
}
}
6 changes: 4 additions & 2 deletions packages/components/Switch/switch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ViBaseSizes } from '../types'

export interface SwitchProps {
modelValue: boolean
disabled?: boolean
Expand All @@ -10,7 +12,7 @@ export interface SwitchProps {
onIcon?: string
offIcon?: string
width?: string
size?: 'small' | 'normal' | 'large'
size?: ViBaseSizes
}

export interface SwitchEmits {
Expand All @@ -26,4 +28,4 @@ export type SwitchTexts = ['onText', 'offText']
export interface SwitchSlots {
on?: (props: {}) => any
off?: (props: {}) => any
}
}
6 changes: 4 additions & 2 deletions packages/components/Tag/tag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ViBaseTypes } from '../types'

export interface TagProps {
type?: 'primary' | 'success' | 'info' | 'warning' | 'danger'
type?: ViBaseTypes
border?: boolean
closable?: boolean
disabled?: boolean
Expand All @@ -12,4 +14,4 @@ export interface TagEmits {

export interface TagSlots {
default?: (props: {}) => any
}
}
5 changes: 5 additions & 0 deletions packages/components/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** violet 基础类型 */
export type ViBaseTypes = 'primary' | 'success' | 'info' | 'warning' | 'danger'

/** violet 基础尺寸 */
export type ViBaseSizes = 'small' | 'normal' | 'large'

0 comments on commit c5920b3

Please sign in to comment.