-
-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ui/**/props): 修改string类型为具体可选项的联合类型,优化类型提示。
affects: @varlet/ui
- Loading branch information
Showing
12 changed files
with
23 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
import { PropType } from 'vue' | ||
|
||
function justifyValidator(justify: string) { | ||
return [ | ||
'flex-start', | ||
'flex-end', | ||
'center', | ||
'space-between', | ||
'space-around' | ||
].includes(justify) | ||
return ['flex-start', 'flex-end', 'center', 'space-between', 'space-around'].includes(justify) | ||
} | ||
|
||
function alignValidator(align: string) { | ||
return ['flex-start', 'flex-center', 'flex-end'].includes(align) | ||
return ['flex-start', 'center', 'flex-end'].includes(align) | ||
} | ||
|
||
export const props = { | ||
gutter: { | ||
type: [String, Number], | ||
default: 0 | ||
default: 0, | ||
}, | ||
justify: { | ||
type: String, | ||
type: String as PropType<'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around'>, | ||
default: 'flex-start', | ||
validator: justifyValidator | ||
validator: justifyValidator, | ||
}, | ||
align: { | ||
type: String, | ||
type: String as PropType<'flex-start' | 'center' | 'flex-end'>, | ||
default: 'flex-start', | ||
validator: alignValidator | ||
validator: alignValidator, | ||
}, | ||
onClick: { | ||
type: Function as PropType<(e: Event) => void> | ||
} | ||
type: Function as PropType<(e: Event) => void>, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters