ant-design/components/anchor/AnchorLink.tsx

21 lines
450 B
TypeScript
Raw Normal View History

2016-10-28 14:02:55 +08:00
import React from 'react';
export interface AnchorLinkProps {
href: string;
onClick: (href: string) => {};
active: boolean;
}
export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
onClick = () => {
if (this.props.href) {
this.props.onClick(this.props.href);
}
}
render() {
return <div onClick={this.onClick}>
{this.props.active ? 'active':null } {this.props.children}
</div>;
}
}