IconButton 图标按钮
WIconButton 是 Button 的别名,不增加默认尺寸、图标库或无障碍属性。
本期保持 PrimeVue 4.5.5 原生 API。使用前按快速开始安装插件与 CSS。
交互示例
使用代码
vue
<script setup lang="ts">
import { Add1Icon } from '@wizdomt/icons'
import { ref } from 'vue'
import { WIconButton } from '@wizdomt/ui'
const count = ref(0)
</script>
<template>
<WIconButton aria-label="添加" rounded outlined @click="count++">
<template #icon><Add1Icon :size="18" /></template>
</WIconButton>
<span role="status">点击 {{ count }} 次</span>
</template>常用 Props / 配置
| 名称 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| aria-label | 无可见文字时必填 | string | — |
| rounded | 圆形外观 | boolean | false |
事件与方法
click:原生 MouseEvent。
插槽
default、icon、loadingicon;业务 SVG 通过 icon 传入。
响应式与无障碍
组件保持原生行为,不自动切换交互。为交互元素提供 label 或 aria-label;浮层按容器设置 max-width。响应式指南说明设备验证方法。
完整 Props、事件、Slots、Methods 以上游锁定版本类型声明为准。PrimeVue v4 button 文档可能包含较新 4.x API,使用时以本包 TypeScript 提示为准。