feat(Icon): add dot prop (#4425)

This commit is contained in:
neverland
2019-09-11 14:43:54 +08:00
committed by GitHub
parent e69e3d349a
commit 21d5127fd7
16 changed files with 70 additions and 26 deletions
+8 -3
View File
@@ -6,6 +6,7 @@ import { CreateElement, RenderContext } from 'vue/types';
import { DefaultSlots } from '../utils/types';
export type InfoProps = {
dot?: boolean;
info?: string | number;
};
@@ -17,18 +18,22 @@ function Info(
slots: DefaultSlots,
ctx: RenderContext<InfoProps>
) {
if (!isDef(props.info) || props.info === '') {
const { dot, info } = props;
const showInfo = isDef(info) && info !== '';
if (!dot && !showInfo) {
return;
}
return (
<div class={bem()} {...inherit(ctx, true)}>
{props.info}
<div class={bem({ dot })} {...inherit(ctx, true)}>
{dot ? '' : props.info}
</div>
);
}
Info.props = {
dot: Boolean,
info: [Number, String]
};