index.tsx 651 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { use, isDef } from '../utils';
  2. import { inherit } from '../utils/functional';
  3. // Types
  4. import { CreateElement, RenderContext } from 'vue/types';
  5. import { DefaultSlots } from '../utils/use/sfc';
  6. export type InfoProps = {
  7. info?: string | number;
  8. };
  9. const [sfc, bem] = use('info');
  10. function Info(
  11. h: CreateElement,
  12. props: InfoProps,
  13. slots: DefaultSlots,
  14. ctx: RenderContext<InfoProps>
  15. ) {
  16. if (!isDef(props.info) || props.info === '') {
  17. return;
  18. }
  19. return (
  20. <div class={bem()} {...inherit(ctx, true)}>
  21. {props.info}
  22. </div>
  23. );
  24. }
  25. Info.props = {
  26. info: [String, Number]
  27. };
  28. export default sfc<InfoProps>(Info);