diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index a1c553bc6a12..dab6ec2015af 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -8,6 +8,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; export interface AnchorLinkProps { prefixCls?: string; href: string; + target: string; title: React.ReactNode; children?: React.ReactNode; className?: string; @@ -52,7 +53,7 @@ class AnchorLink extends React.Component { }; renderAnchorLink = ({ getPrefixCls }: ConfigConsumerProps) => { - const { prefixCls: customizePrefixCls, href, title, children, className } = this.props; + const { prefixCls: customizePrefixCls, href, title, children, className, target } = this.props; const prefixCls = getPrefixCls('anchor', customizePrefixCls); const active = this.context.antAnchor.activeLink === href; const wrapperClassName = classNames(className, `${prefixCls}-link`, { @@ -67,6 +68,7 @@ class AnchorLink extends React.Component { className={titleClassName} href={href} title={typeof title === 'string' ? title : ''} + target={target} onClick={this.handleClick} > {title} diff --git a/components/anchor/__tests__/__snapshots__/demo.test.js.snap b/components/anchor/__tests__/__snapshots__/demo.test.js.snap index 4f5e30d5aedb..d1cce5bd52e1 100644 --- a/components/anchor/__tests__/__snapshots__/demo.test.js.snap +++ b/components/anchor/__tests__/__snapshots__/demo.test.js.snap @@ -41,6 +41,18 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = ` Static demo +