Skip to content

Button 按钮

按钮用于触发一个操作。Aether UI 提供 6 种类型、4 种尺寸、7 种变体。

基础类型

vue
<AButton>Default</AButton>
<AButton type="tertiary">Tertiary</AButton>
<AButton type="primary">Primary</AButton>
<AButton type="info">Info</AButton>
<AButton type="success">Success</AButton>
<AButton type="warning">Warning</AButton>
<AButton type="error">Error</AButton>

尺寸

vue
<AButton size="tiny">Tiny</AButton>
<AButton size="small">Small</AButton>
<AButton size="medium">Medium</AButton>
<AButton size="large">Large</AButton>

文字按钮 (text)

去除背景和边框,常用在表格操作列或卡片操作区。

vue
<AButton text>Default</AButton>
<AButton text type="primary">Primary</AButton>

虚线按钮 (dashed)

vue
<AButton dashed>Default</AButton>
<AButton dashed type="primary">Primary</AButton>

幽灵按钮 (ghost)

透明背景,适合深色背景上使用。

vue
<AButton ghost>Default</AButton>
<AButton ghost type="primary">Primary</AButton>

Secondary / Tertiary / Quaternary

三种不同程度的弱化按钮。

vue
<AButton secondary type="primary">Secondary</AButton>
<AButton tertiary type="primary">Tertiary</AButton>
<AButton quaternary type="primary">Quaternary</AButton>

形状

vue
<AButton round>圆角按钮</AButton>
<AButton circle type="primary">A</AButton>

按钮组 (ButtonGroup)

vue
<AButtonGroup>
  <AButton>上海</AButton>
  <AButton type="primary">北京</AButton>
  <AButton>深圳</AButton>
</AButtonGroup>

状态

vue
<AButton disabled>禁用</AButton>
<AButton loading type="primary">加载中</AButton>

块级按钮

vue
<AButton block type="primary">占满宽度</AButton>

自定义颜色

通过 colortextColor 属性覆盖默认颜色,hover/pressed 状态自动推导。

vue
<AButton color="#8a2be2">紫色</AButton>
<AButton color="#ff6b6b" text-color="#fff">珊瑚红</AButton>
<AButton dashed color="#8a2be2">紫色虚线</AButton>
<AButton ghost color="#ff6b6b">珊瑚红幽灵</AButton>

波纹控制

文字和虚线按钮默认关闭波纹。可通过 ripple 属性控制。

vue
<AButton type="primary">有波纹</AButton>
<AButton type="primary" :ripple="false">无波纹</AButton>
<AButton text :ripple="true">文字 + 波纹</AButton>
<AButton dashed :ripple="true">虚线 + 波纹</AButton>

API

Button Props

属性类型默认值说明
type'default' | 'tertiary' | 'primary' | 'info' | 'success' | 'warning' | 'error''default'按钮类型
size'tiny' | 'small' | 'medium' | 'large''medium'按钮尺寸
textbooleanfalse文字按钮,无背景无边框
ghostbooleanfalse幽灵按钮,透明背景
dashedbooleanfalse虚线边框
secondarybooleanfalse次要按钮
tertiarybooleanfalse三级按钮
quaternarybooleanfalse四级按钮
blockbooleanfalse块级按钮,占满容器宽度
roundbooleanfalse圆角按钮
circlebooleanfalse圆形按钮
disabledbooleanfalse禁用状态
loadingbooleanfalse加载中状态
borderedbooleantrue是否显示边框
ripplebooleantrue是否显示点击波纹
colorstring自定义背景色
textColorstring自定义文字色
onClick(e: MouseEvent) => void点击回调

ButtonGroup Props

属性类型默认值说明
size'tiny' | 'small' | 'medium' | 'large'统一按钮组内尺寸
verticalbooleanfalse竖向排列

Released under the MIT License.