mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-24 04:15:54 +08:00
fix(button): fix error where native type is overridden
This commit is contained in:
@@ -7,6 +7,7 @@ exports[`Button should render empty button correctly 1`] = `
|
||||
disabled={false}
|
||||
effect={true}
|
||||
ghost={false}
|
||||
htmlType="button"
|
||||
loading={false}
|
||||
shadow={false}
|
||||
size="medium"
|
||||
@@ -23,6 +24,7 @@ exports[`Button should render special styles 2`] = `
|
||||
disabled={false}
|
||||
effect={true}
|
||||
ghost={false}
|
||||
htmlType="button"
|
||||
loading={true}
|
||||
shadow={false}
|
||||
size="medium"
|
||||
|
||||
@@ -17,6 +17,7 @@ interface Props {
|
||||
auto?: boolean
|
||||
effect?: boolean
|
||||
disabled?: boolean
|
||||
htmlType?: React.ButtonHTMLAttributes<any>['type']
|
||||
icon?: React.ReactNode
|
||||
iconRight?: React.ReactNode
|
||||
onClick?: React.MouseEventHandler<HTMLButtonElement>
|
||||
@@ -26,6 +27,7 @@ interface Props {
|
||||
const defaultProps = {
|
||||
type: 'default' as ButtonTypes,
|
||||
size: 'medium' as NormalSizes,
|
||||
htmlType: 'button' as React.ButtonHTMLAttributes<any>['type'],
|
||||
ghost: false,
|
||||
loading: false,
|
||||
shadow: false,
|
||||
@@ -57,6 +59,7 @@ const Button: React.FC<React.PropsWithChildren<ButtonProps>> = ({ ...btnProps })
|
||||
auto,
|
||||
size,
|
||||
icon,
|
||||
htmlType,
|
||||
iconRight,
|
||||
className,
|
||||
...props
|
||||
@@ -115,7 +118,7 @@ const Button: React.FC<React.PropsWithChildren<ButtonProps>> = ({ ...btnProps })
|
||||
return (
|
||||
<button
|
||||
ref={buttonRef}
|
||||
type="button"
|
||||
type={htmlType}
|
||||
className={`btn ${className}`}
|
||||
disabled={disabled}
|
||||
onClick={clickHandler}
|
||||
|
||||
Reference in New Issue
Block a user