From 7eb68649bd4d4a0c0c774b50145301e056e9055f Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Thu, 23 May 2019 16:40:35 +0800 Subject: [PATCH] =?UTF-8?q?Button=20=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20href?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Button.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 37af5657..5442772f 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -12,6 +12,7 @@ interface ButtonProps extends React.DetailedHTMLProps, HTMLButtonElement> { id?: string; className?: string; + href?: string; size?: 'xs' | 'sm' | 'md' | 'lg'; type: 'button' | 'reset' | 'submit'; level: string; // 'link' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'light' | 'dark' | 'default'; @@ -44,7 +45,7 @@ export class Button extends React.Component { }; renderButton() { - const { + let { level, size, disabled, @@ -57,13 +58,19 @@ export class Button extends React.Component { type, active, iconOnly, + href, ...rest } = this.props; + if (href) { + Comp = 'a'; + } + return (