refactor: info component

This commit is contained in:
chenjiahan
2020-07-04 22:38:53 +08:00
parent 79e7b4be65
commit 425ffb87eb
4 changed files with 91 additions and 0 deletions

23
src-next/info/index.js Normal file
View File

@@ -0,0 +1,23 @@
// Utils
import { isDef } from '../../src/utils';
import { createNamespace } from '../utils/create';
const [createComponent, bem] = createNamespace('info');
export default createComponent({
props: {
dot: Boolean,
info: [Number, String],
},
render() {
const { dot, info } = this;
const showInfo = isDef(info) && info !== '';
if (!dot && !showInfo) {
return;
}
return <div class={bem({ dot })}>{dot ? '' : info}</div>;
},
});