Browse Source

Merge remote-tracking branch 'origin/main'

main
lk 2 weeks ago
parent
commit
9fad454342
  1. 6
      src/components/action/Action.tsx

6
src/components/action/Action.tsx

@ -10,11 +10,15 @@ const Action = ({ title, as, children, ...props }: ActionProps) => {
const { styles } = useStyle()
const isLink = as === 'a' || props.type === 'link'
//fixme 如果外部同时设置 as={'a'} disabled={true} ,这里a标签会置灰,但是仍可点击,为什么不直接用Button?
const Comp = isLink ? 'a' : Button
return (
<span className={styles.container}>
<Comp {...props}
onClick={(e) => {
if (props.onClick && !props.disabled) {
props.onClick(e)
}
}}
type={isLink ? 'link' : props.type}
className={as === 'a' ? styles.actionA : ''}>{title ?? children}</Comp>
</span>

Loading…
Cancel
Save