Skip to content

Bubble 气泡框

附着于指定目标节点上下的提示气泡框组件,支持上下左右 4 方向定位、深浅高斯毛玻璃主题、45 度指示箭头与自定义内容插槽。


代码示例

1. 基础用法 (Basic Usage)

vue
<template>
  <mu-bubble placement="top" content="上方提示文字">
    <template #trigger>
      <button>点击触发气泡</button>
    </template>
  </mu-bubble>
</template>

2. 4 方向定位 (4 Placements)

设置 placement 属性为 topbottomleftright

vue
<template>
  <mu-bubble placement="top" content="Top 向上" />
  <mu-bubble placement="bottom" content="Bottom 向下" />
  <mu-bubble placement="left" content="Left 向左" />
  <mu-bubble placement="right" content="Right 向右" />
</template>

API 属性说明 (Props)

参数名说明类型可选值默认值
visible / v-model:visible是否显示气泡框Booleantrue | falsefalse
placement气泡弹出方向定位Stringtop | bottom | left | right'top'
theme配色主题风格Stringdark (深色) | light (浅色高斯毛玻璃)'dark'
content简易气泡提示文字String-''
trigger触发方式Stringclick | hover'click'
showArrow是否显示 45 度旋转指示小尖角箭头Booleantrue | falsetrue
width自定义气泡内容面板宽度String-''
offset气泡偏移量 [垂直, 水平],单位 rpxArray-[0, 0]

事件说明 (Events)

事件名说明回调参数
update:visiblev-model:visible 双向绑定更新(visible: boolean)
show气泡框展开弹出时触发-
hide气泡框收起隐藏时触发-
change气泡显示隐藏状态改变时触发(visible: boolean)

实例方法 (Expose Methods)

方法名说明
show()手动展开显示气泡
hide()手动收起隐藏气泡
toggle()切换展开/收起状态

基于 MIT 协议开源发行

H5 模拟器 (bubble)☀️🔄