mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
parent
4a3cf8d6e7
commit
f15c08a898
@ -29,7 +29,7 @@ export default class CheckableTag extends React.Component<CheckableTagProps> {
|
||||
);
|
||||
|
||||
delete (restProps as any).onChange; // TypeScript cannot check delete now.
|
||||
return <div {...(restProps as any)} className={cls} onClick={this.handleClick} />;
|
||||
return <span {...(restProps as any)} className={cls} onClick={this.handleClick} />;
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -11,7 +11,7 @@ import Wave from '../_util/wave';
|
||||
|
||||
export { CheckableTagProps } from './CheckableTag';
|
||||
|
||||
export interface TagProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
color?: string;
|
||||
@ -118,19 +118,23 @@ class Tag extends React.Component<TagProps, TagState> {
|
||||
const { prefixCls: customizePrefixCls, children, ...otherProps } = this.props;
|
||||
const isNeedWave =
|
||||
'onClick' in otherProps || (children && (children as React.ReactElement<any>).type === 'a');
|
||||
const divProps = omit(otherProps, ['onClose', 'afterClose', 'color', 'visible', 'closable']);
|
||||
const tagProps = omit(otherProps, ['onClose', 'afterClose', 'color', 'visible', 'closable']);
|
||||
return isNeedWave ? (
|
||||
<Wave>
|
||||
<div {...divProps} className={this.getTagClassName(configProps)} style={this.getTagStyle()}>
|
||||
<span
|
||||
{...tagProps}
|
||||
className={this.getTagClassName(configProps)}
|
||||
style={this.getTagStyle()}
|
||||
>
|
||||
{children}
|
||||
{this.renderCloseIcon()}
|
||||
</div>
|
||||
</span>
|
||||
</Wave>
|
||||
) : (
|
||||
<div {...divProps} className={this.getTagClassName(configProps)} style={this.getTagStyle()}>
|
||||
<span {...tagProps} className={this.getTagClassName(configProps)} style={this.getTagStyle()}>
|
||||
{children}
|
||||
{this.renderCloseIcon()}
|
||||
</div>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user