types(Badge): improve typing

This commit is contained in:
chenjiahan
2020-08-23 12:07:37 +08:00
parent d86238f071
commit 1b96a45d0b
2 changed files with 9 additions and 4 deletions
+6 -1
View File
@@ -2,13 +2,18 @@ import { isDef, createNamespace } from '../utils';
const [createComponent, bem] = createNamespace('badge');
export type BadgeProps = {
dot?: boolean;
badge?: number | string;
};
export default createComponent({
props: {
dot: Boolean,
badge: [Number, String],
},
setup(props) {
setup(props: BadgeProps) {
return () => {
const { dot, badge } = props;
const hasBadge = isDef(badge) && badge !== '';