按钮 Button
对应 Arco 的 Button:默认按钮是 Arco 的 secondary(灰底无边框),plain 对应 outline,dashed 对应 dashed,text 对应 text。属性用法见 Element Plus 文档。
基础类型
默认按钮是灰底的 secondary;plain 是描边,dashed 是虚线,text 和 link 是文字按钮。
vue
<template>
<el-button type="primary">Primary</el-button>
<el-button>Default</el-button>
<el-button type="primary" plain>Plain</el-button>
<el-button dashed>Dashed</el-button>
<el-button text>Text</el-button>
<el-button link type="primary">Link</el-button>
</template>状态颜色
success / warning / danger 对应 Arco 的 status;Arco 没有 info 状态,info 用中性灰。
vue
<template>
<el-button type="success">Success</el-button>
<el-button type="warning">Warning</el-button>
<el-button type="danger">Danger</el-button>
<el-button type="info">Info</el-button>
<el-button type="success" plain>Success</el-button>
<el-button type="warning" plain>Warning</el-button>
<el-button type="danger" plain>Danger</el-button>
</template>尺寸与状态
small / 默认 / large 对应 Arco 的 small / medium / large(28 / 32 / 36px);图标、圆角、加载和禁用。
vue
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
</script>
<template>
<el-button type="primary" size="small">Small</el-button>
<el-button type="primary">Default</el-button>
<el-button type="primary" size="large">Large</el-button>
<el-button type="primary" :icon="Search" circle />
<el-button :icon="Search" round>Round</el-button>
<el-button type="primary" loading>Loading</el-button>
<el-button type="primary" disabled>Disabled</el-button>
<el-button disabled>Disabled</el-button>
</template>按钮组
实心按钮直接相邻,右边框是分隔线;描边按钮重叠 1px;只有两端有圆角。
vue
<template>
<el-button-group>
<el-button>Left</el-button>
<el-button>Middle</el-button>
<el-button>Right</el-button>
</el-button-group>
<el-button-group>
<el-button type="primary">Left</el-button>
<el-button type="primary">Middle</el-button>
<el-button type="primary">Right</el-button>
</el-button-group>
<el-button-group>
<el-button type="primary" plain>Left</el-button>
<el-button type="primary" plain>Middle</el-button>
<el-button type="primary" plain>Right</el-button>
</el-button-group>
</template>与 Arco 的差异
- 图标集不同:加载图标等使用 Element Plus 的图标。
- 加载中的按钮带
disabled属性,不能获得焦点(Element Plus 的行为)。 direction="vertical"的按钮组 Arco 没有,保留 Element Plus 的形态。