Skip to content

Popover 气泡卡片

点击或移入元素,弹出气泡式的卡片浮层。

基础用法

最基础的用法。

vue
<template>
  <SxoPopover title="标题" content="这是一段内容描述。">
    <SxoButton>气泡卡片</SxoButton>
  </SxoPopover>
</template>

触发方式

支持 click (默认) 和 hover 两种触发方式。

vue
<template>
  <SxoPopover trigger="hover" title="悬停提示" content="移入时显示,移出时隐藏。">
    <SxoButton variant="outline">移入触发</SxoButton>
  </SxoPopover>
</template>

弹出位置

支持 top (默认)、bottomleftright 四个位置。

vue
<template>
  <div class="flex gap-4">
    <SxoPopover placement="left" title="左侧" content="内容弹出在左侧。">
      <SxoButton>左侧</SxoButton>
    </SxoPopover>
    <SxoPopover placement="right" title="右侧" content="内容弹出在右侧。">
      <SxoButton>右侧</SxoButton>
    </SxoPopover>
  </div>
</template>

Popover 属性

参数说明类型默认值
title标题string-
content内容string-
trigger触发方式'click' | 'hover''click'
placement弹出位置'top' | 'bottom' | 'left' | 'right''top'

Popover 插槽

名称说明
default触发元素
title自定义标题
content自定义内容

API

参数说明类型默认值
title-String""
content-String""
placement-String"top"
trigger-String"click"