mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
refactor: info component
This commit is contained in:
23
src-next/info/index.js
Normal file
23
src-next/info/index.js
Normal 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>;
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user