InputIcon.js 638 B

12345678910111213141516171819202122
  1. import Icon from '../icon';
  2. import { isValidElement } from '../_util/props-util';
  3. import { cloneElement } from '../_util/vnode';
  4. export default {
  5. functional: true,
  6. render: function render(h, context) {
  7. var props = context.props;
  8. var suffixIcon = props.suffixIcon,
  9. prefixCls = props.prefixCls;
  10. return (suffixIcon && isValidElement(suffixIcon) ? cloneElement(suffixIcon, {
  11. 'class': prefixCls + '-picker-icon'
  12. }) : h(
  13. 'span',
  14. { 'class': prefixCls + '-picker-icon' },
  15. [suffixIcon]
  16. )) || h(Icon, {
  17. attrs: { type: 'calendar' },
  18. 'class': prefixCls + '-picker-icon' });
  19. }
  20. };