vant/src-next/info/index.js
2020-07-07 15:06:16 +08:00

23 lines
430 B
JavaScript

// Utils
import { isDef, createNamespace } from '../utils';
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>;
},
});