Button 按钮
常用的操作按钮
参数
Props
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
type | ComponentType | 'default' | 按钮类型 |
size | ComponentSize | 'medium' | 按钮大小 |
variant | ComponentVariant | 'filled' | 按钮变体款式 |
shape | ComponentShape | 'default' | 按钮外观形状 |
disabled | boolean | false | 按钮是否禁用 |
loading | boolean | false | 按钮是否加载中 |
loadingOptions | LoadingProps | - | 按钮加载选项 |
flat | boolean | false | 按钮是否扁平化 |
ripple | boolean | true | 按钮水波纹效果 |
Slots
名称 | 描述 | 参数 |
---|---|---|
default | 默认插槽,用于显示按钮的主要内容 | - |
loading | loading 状态的图标插槽 | - |
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";