简体中文
FxButton
约 1182 字大约 4 分钟
2025-12-22
用于触发操作的按钮组件。
Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 | PC/移动端支持情况 |
|---|---|---|---|---|---|
| size | 尺寸 | string | medium / small / mini | — | 仅PC |
| type | 类型 | string | primary / success / warning / danger / info / text | — | 移动端仅支持primary/ success/ default/ danger |
| plain | 是否朴素按钮 | boolean | — | false | PC/移动端 |
| round | 是否圆角按钮 | boolean | — | false | 仅PC |
| circle | 是否圆形按钮 | boolean | — | false | 仅PC |
| loading | 是否加载中状态 | boolean | — | false | PC/移动端 |
| disabled | 是否禁用状态 | boolean | — | false | PC/移动端 |
| icon | 图标类名 | string | — | — | 仅PC |
| autofocus | 是否默认聚焦 | boolean | — | false | 仅PC |
| native-type | 原生 type 属性 | string | button / submit / reset | button | 仅PC |
Slot
仅移动端。
| name | 说明 |
|---|---|
| content | 按钮内容 |
基础用法
基础的按钮用法。
<fx-row>
<fx-button>默认按钮</fx-button>
<fx-button type="primary">主要按钮 <i class="el-icon-arrow-down"></i></fx-button>
<fx-button type="success">成功按钮</fx-button>
<fx-button type="info">信息按钮</fx-button>
<fx-button type="warning">警告按钮</fx-button>
<fx-button type="danger">危险按钮</fx-button>
</fx-row>
<fx-row>
<fx-button plain>朴素按钮</fx-button>
<fx-button type="primary" plain>主要按钮</fx-button>
<fx-button type="success" plain>成功按钮</fx-button>
<fx-button type="info" plain>信息按钮</fx-button>
<fx-button type="warning" plain>警告按钮</fx-button>
<fx-button type="danger" plain>危险按钮</fx-button>
</fx-row>
<fx-row>
<fx-button round>圆角按钮</fx-button>
<fx-button type="primary" round>主要按钮</fx-button>
<fx-button type="success" round>成功按钮</fx-button>
<fx-button type="info" round>信息按钮</fx-button>
<fx-button type="warning" round>警告按钮</fx-button>
<fx-button type="danger" round>危险按钮</fx-button>
</fx-row>
<fx-row>
<fx-button icon="el-icon-search" circle></fx-button>
<fx-button type="primary" icon="el-icon-edit" circle></fx-button>
<fx-button type="success" icon="el-icon-check" circle></fx-button>
<fx-button type="info" icon="el-icon-message" circle></fx-button>
<fx-button type="warning" icon="el-icon-star-off" circle></fx-button>
<fx-button type="danger" icon="el-icon-delete" circle></fx-button>
</fx-row>禁用状态
按钮不可用状态。
<fx-row>
<fx-button disabled>默认按钮</fx-button>
<fx-button type="primary" disabled>主要按钮</fx-button>
<fx-button type="success" disabled>成功按钮</fx-button>
<fx-button type="info" disabled>信息按钮</fx-button>
<fx-button type="warning" disabled>警告按钮</fx-button>
<fx-button type="danger" disabled>危险按钮</fx-button>
</fx-row>
<fx-row>
<fx-button plain disabled>朴素按钮</fx-button>
<fx-button type="primary" plain disabled>主要按钮</fx-button>
<fx-button type="success" plain disabled>成功按钮</fx-button>
<fx-button type="info" plain disabled>信息按钮</fx-button>
<fx-button type="warning" plain disabled>警告按钮</fx-button>
<fx-button type="danger" plain disabled>危险按钮</fx-button>
</fx-row>文字按钮
没有边框和背景色的按钮。
<fx-button type="text">文字按钮</fx-button>
<fx-button type="text" disabled>文字按钮</fx-button>图标按钮
带图标的按钮可增强辨识度(有文字)或节省空间(无文字)。
<fx-button type="primary" icon="el-icon-edit"></fx-button>
<fx-button type="primary" icon="el-icon-share"></fx-button>
<fx-button type="primary" icon="el-icon-delete"></fx-button>
<fx-button type="primary" icon="el-icon-search">搜索</fx-button>
<fx-button type="primary">上传<i class="el-icon-upload el-icon--right"></i></fx-button>按钮组
以按钮组的方式出现,常用于多项类似操作。
<fx-button-group>
<fx-button type="primary" icon="el-icon-arrow-left">上一页</fx-button>
<fx-button type="primary">下一页<i class="el-icon-arrow-right el-icon--right"></i></fx-button>
</fx-button-group>
<fx-button-group>
<fx-button type="primary" icon="el-icon-edit"></fx-button>
<fx-button type="primary" icon="el-icon-share"></fx-button>
<fx-button type="primary" icon="el-icon-delete"></fx-button>
</fx-button-group>加载中
点击按钮后进行数据加载操作,在按钮上显示加载状态。
<fx-button type="primary" :loading="true">加载中</fx-button>不同尺寸
Button 组件提供除了默认值以外的三种尺寸,可以在不同场景下选择合适的按钮尺寸。
<fx-row>
<fx-button>默认按钮</fx-button>
<fx-button size="medium">中等按钮</fx-button>
<fx-button size="small">小型按钮</fx-button>
<fx-button size="mini">超小按钮</fx-button>
<fx-button size="micro">超超小按钮</fx-button>
</fx-row>
<fx-row>
<fx-button round>默认按钮</fx-button>
<fx-button size="medium" round>中等按钮</fx-button>
<fx-button size="small" round>小型按钮</fx-button>
<fx-button size="mini" round>超小按钮</fx-button>
<fx-button size="micro" round>超超小按钮</fx-button>
</fx-row>