Skip to content

Commit

Permalink
feat: [radio] 添加文字hover的提示title fix kingdee#831
Browse files Browse the repository at this point in the history
  • Loading branch information
haohao_peng committed Jul 18, 2024
1 parent 36aa2cc commit 9db6341
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/radio/radio-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ const RadioButton = (props: IRadioProps, ref: React.Ref<any>) => {
const radioGroupContext = React.useContext(RadioGroupContext)
const { getPrefixCls, prefixCls, compDefaultProps: userDefaultProps } = React.useContext(ConfigContext)

const { prefixCls: customPrefixcls, ...radioProps } = getCompProps('Radio', userDefaultProps, props)
let { prefixCls: customPrefixcls, title, children, ...radioProps } = getCompProps('Radio', userDefaultProps, props)

if (typeof children === 'string' && typeof title === 'undefined') {
title = children
}

const radioButtonPrefixCls = getPrefixCls?.(prefixCls, `radio-button`, customPrefixcls)
if (radioGroupContext) {
radioProps.checked = props.value === radioGroupContext.value
radioProps.disabled = props.disabled || radioGroupContext.disabled
}
return <Radio prefixCls={radioButtonPrefixCls} {...radioProps} type="radio" ref={ref} />
return (
<Radio title={title} prefixCls={radioButtonPrefixCls} {...radioProps} type="radio" ref={ref}>
{children}
</Radio>
)
}

export default React.forwardRef(RadioButton)

0 comments on commit 9db6341

Please sign in to comment.