# Popover 气泡
# 使用指南
气泡式弹窗组件,可添加描述或者额外的菜单;若是简单文本描述请使用Tooltip组件;
# 与h3-mobile-vue组件的区别以及迁移
通过对组件梳理,进行重构及统一风格及UI。引用了popper.js来对气泡进行定位。若要做迁移请参考
弃用了H3PopoverItem
组件
- 弃用的props:
menus
gutter
- 替换的props:-
- 新增的props:
maskCls
offset
disabled
always
control
wrapCls
getRenderContainer
type
reference
placement
枚举新增了top-start
top-end
bottom-start
bottom-end
bottom-start
bottom-end
left-start
left-end
right-start
right-end
,弃用了topLeft
topRight
bottomLeft
bottomRight
# 代码演示
# API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
mask | 是否显示遮罩层 | boolean | false |
visible | 是否显示,v-model 绑定值 | boolean | false |
reference | 参照元素,可以为VNode,或者DOM元素,若使用该方式,default插槽请不要使用 | VNode,DOM | - |
placement | 位置,可选值:top left right bottom top-start top-end bottom-start bottom-end bottom-start bottom-end left-start left-end right-start right-end | string | bottom |
type | 气泡类型 default primary warning error success | string | default |
maskCls | mask蒙层自定义class | string | 无 |
wrapCls | wrap弹窗内容区域的自定义class | string | 无 |
getRenderContainer | 把组件挂载某个地方,函数请返回节点,字符串默认通过document.querySelector 查找 | Function=> Node / String | document.body |
offset | 气泡弹出后偏移量, 一般用来进行气泡偏移调整 | number | 0 |
disabled | 是否禁用 | boolean | false |
always | 是否一直呈现 | boolean | false |
control | 是否由父组件控制显示隐藏,默认是在触发气泡组件上添加点击事件,触发 | boolean | false |
# Slot
属性 | 说明 | 参数 |
---|---|---|
default | 触发气泡的组件 | - |
content | 气泡内容插槽 | - |
# Event
事件名 | 说明 | 参数 |
---|---|---|
toggle | 切换显示时触发,v-model 绑定事件 | value |
show | 显示时回调 | - |
hide | 关闭时回调 | - |