Appearance
BaseButton
按钮基础件,通过组合 icon / tooltip / active / pressed / disabled / type / iconPlacement 等属性构建各类工具栏按钮。
用法
vue
<script setup lang="ts">
import { BaseButton } from '@qingpai/vue'
</script>
<template>
<BaseButton
icon="bold"
tooltip="加粗"
@click="editor.chain().focus().toggleBold().run()"
/>
</template>Props
| Prop | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
classes | BaseButtonClasses | — | 否 | 自定义类名(root / text) |
icon | BaseIconName | — | 否 | 注册表图标名(iconRegistry 键名) |
iconSize | string | '18' | 否 | 图标尺寸 |
iconPlacement | 'start' | 'end' | — | 否 | 图标位置 |
tooltip | string | — | 否 | 悬停提示文字 |
trigger | TooltipProps['trigger'] | — | 否 | 提示触发方式 |
active | boolean | — | 否 | 激活态样式 |
pressed | boolean | — | 否 | 按下态(aria-pressed) |
disabled | boolean | — | 否 | 禁用 |
type | 'default' | 'primary' | 'error' | 'default' | 否 | 按钮类型 |
插槽
| 名称 | 参数 | 说明 |
|---|---|---|
default | — | 按钮文字内容 |
icon | — | 自定义图标 |
事件
| 名称 | 参数 | 说明 |
|---|---|---|
click | (event: MouseEvent) | 点击时触发 |