KPlainButton 按钮
固定为 plain 样式的按钮。传 icon 属性或用 icon 插槽放图标,其余属性(type、size、disabled、loading 等)透传给 el-button。
基础用法
支持组件图标、Element Plus type、disabled,以及自定义 icon 插槽。
docs/examples/plain-button/basic.vue
vue
<script setup lang="ts">
import { Refresh, Search } from '@element-plus/icons-vue';
import { KPlainButton } from '@wujies/components';
</script>
<template>
<div style="display: flex; flex-wrap: wrap; gap: 12px; align-items: center">
<KPlainButton>默认按钮</KPlainButton>
<KPlainButton :icon="Search">搜索</KPlainButton>
<KPlainButton type="primary" :icon="Refresh">刷新</KPlainButton>
<KPlainButton disabled>禁用</KPlainButton>
<KPlainButton>
<template #icon>+</template>
自定义图标插槽
</KPlainButton>
</div>
</template>
API
Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| icon | 按钮图标 | string / Component | — | — |
| type | 按钮类型,透传 | string | primary / success / warning / danger / info | — |
| size | 按钮尺寸,透传 | string | large / default / small | — |
| disabled | 是否禁用,透传 | boolean | — | false |
| loading | 是否加载中,透传 | boolean | — | false |
Slots
| 插槽名 | 说明 |
|---|---|
| icon | 自定义图标,优先级高于 icon 属性 |
| default | 按钮文字 |
TIP
组件固定带 plain 属性。需要非 plain 样式时直接用 el-button。