CopyText
带状态反馈的复制文本组件,封装剪贴板写入逻辑,提供加载、已复制、出错三种视觉状态。
基础用法
自定义展示内容
自定义图标
禁用状态
API
Props
| 名称 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| copyLabel | string | undefined | "复制" | — | Accessible label and tooltip shown before a successful copy. |
| copiedLabel | string | undefined | "已复制" | — | Accessible label and tooltip shown after a successful copy. |
| text | string | — | 是 | Plain text written to the clipboard. |
| disabled | boolean | undefined | false | — | Prevent copy commands while preserving the slot state. |
| resetDelay | number | undefined | 2000 | — | Time before the copied state resets. Set to 0 to keep it until the next command. |
Emits
| 名称 | 参数 | 说明 |
|---|---|---|
| error | — | |
| copy | [text: string] | — |
Slots
| 名称 | 作用域 | 说明 |
|---|---|---|
| default | — | |
| icon | — |
Expose
| 名称 | 类型 | 说明 |
|---|---|---|
| copy | — | |
| reset | () => void | — |