Skip to content

Button 按钮 ​

常用的操作按钮

参数 ​

Props ​

名称类型默认值描述
typeComponentType'default'按钮类型
sizeComponentSize'medium'按钮大小
variantComponentVariant'filled'按钮变体款式
shapeComponentShape'default'按钮外观形状
disabledbooleanfalse按钮是否禁用
loadingbooleanfalse按钮是否加载中
loadingOptionsLoadingProps-按钮加载选项
flatbooleanfalse按钮是否扁平化
ripplebooleantrue按钮水波纹效果

Slots ​

名称描述参数
default默认插槽,用于显示按钮的主要内容-
loadingloading 状态的图标插槽-
icon图标插槽,用于显示按钮的前置图标-

Events ​

名称描述参数
click点击事件() => void
longpress长按事件() => void

示例 ​

基础按钮 ​

变体 ​

形状 ​

尺寸 ​

状态 ​

事件 ​

TypeScript ​

ts
// 基础颜色类型
export type ComponentType =
  | "default"
  | "primary"
  | "secondary"
  | "success"
  | "warning"
  | "error"
  | "info";

// 组件尺寸
export type ComponentSize = "small" | "medium" | "large";

// 组件变体
export type ComponentVariant = "filled" | "light" | "outlined" | "text";

// 组件形状
export type ComponentShape = "default" | "round" | "circle" | "square";