From a5f1fc80fd39d705a52415fd4a9a3ac2babb156a Mon Sep 17 00:00:00 2001 From: DiamondYuan Date: Mon, 19 Aug 2019 11:10:06 +0800 Subject: [PATCH 1/6] fix: Anchor.Link add add new property target (#18335) * fix: Anchor.Link add add new property target * docs: update doc of anchor --- components/anchor/AnchorLink.tsx | 4 +++- .../anchor/__tests__/__snapshots__/demo.test.js.snap | 12 ++++++++++++ components/anchor/demo/basic.md | 1 + components/anchor/index.en-US.md | 9 +++++---- components/anchor/index.zh-CN.md | 9 +++++---- 5 files changed, 26 insertions(+), 9 deletions(-) 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 +