在触发元素旁展示一段富内容(标题 + 正文或自定义插槽)。
<script setup lang="ts">
import { DanButton, DanPopover } from '@dandan-ui/ui'
</script>
<template>
<div style="display: flex; gap: 16px; padding: 24px 0">
<DanPopover
title="标题"
content="这是一段 Popover 内容,可放说明或轻量操作。"
trigger="click"
>
<DanButton>点击触发</DanButton>
</DanPopover>
<DanPopover title="悬停" content="hover 时出现" trigger="hover">
<DanButton>悬停触发</DanButton>
</DanPopover>
</div>
</template>| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 标题 | string | '' |
| content | 正文 | string | '' |
| placement | 位置 | 'top' | 'bottom' | 'left' | 'right' | 'bottom' |
| trigger | 触发方式 | 'click' | 'hover' | 'click' |
| width | 面板宽度 | string | number | 240 |
| disabled | 禁用 | boolean | false |
| visible | 受控显示 | boolean | — |
| 插槽 | 说明 |
|---|---|
| default | 触发元素 |
| title | 自定义标题 |
| content | 自定义正文 |