Skip to content

Commit

Permalink
fix: form validateStatus icon not work #321
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Dec 19, 2018
1 parent 3393f0e commit d55d1f5
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion components/form/FormItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { initDefaultProps, getComponentFromProp, filterEmpty, getSlotOptions, is
import getTransitionProps from '../_util/getTransitionProps'
import BaseMixin from '../_util/BaseMixin'
import { cloneElement, cloneVNodes } from '../_util/vnode'
import Icon from '../icon'

export const FormItemProps = {
id: PropTypes.string,
prefixCls: PropTypes.string,
Expand Down Expand Up @@ -204,9 +206,33 @@ export default {
'is-validating': validateStatus === 'validating',
})
}
let iconType = ''
switch (validateStatus) {
case 'success':
iconType = 'check-circle'
break
case 'warning':
iconType = 'exclamation-circle'
break
case 'error':
iconType = 'close-circle'
break
case 'validating':
iconType = 'loading'
break
default:
iconType = ''
break
}
const icon = (props.hasFeedback && iconType)
? <span class={`${props.prefixCls}-item-children-icon`}>
<Icon type={iconType} theme={iconType === 'loading' ? 'outlined' : 'filled'} />
</span> : null
return (
<div class={classes}>
<span class={`${props.prefixCls}-item-children`}>{c1}</span>
<span class={`${props.prefixCls}-item-children`}>
{c1}{icon}
</span>
{c2}{c3}
</div>
)
Expand Down

0 comments on commit d55d1f5

Please sign in to comment.