Show:

bui.popover Class

Extends bui.dialog
Module: UI

Available since 1.7.6

动态自定义html弹窗

Constructor

bui.popover

(
  • title
  • content
  • mask
  • showArrow
  • direction
  • onClickMain
  • style
  • zIndex
  • autoClose
  • position
  • effect
)

Defined in src/scripts/ui/bui.popover.js:10

Available since 1.7.6

Parameters:

  • title String

    标题,默认为 “” 不显示

  • content String

    内容,可以是HTML

  • mask Boolean

    显示遮罩 默认 false | true

  • showArrow Boolean

    非全屏下可以展示箭头 默认 false | true

  • direction Boolean

    展示箭头的方向 默认 up| down | left | right

  • onClickMain Function

    点击中间内容的回调

  • style Object

    用于修改 top,bottom 等之类的属性

  • zIndex Number

    层级默认 zIndex:121

  • autoClose Boolean

    默认 true | false

  • position String

    默认 center

  • effect String

    默认 zoomIn 更多效果,请查看 bui.toggle

Example:

方法2 可以修改更多参数: 具体参数请查看 bui.dialog

       bui.popover({
                                               content:"确定会删除信息,不可还原",
                                               title:"修改了标题"
                                           })
                                    

Methods

close

(
  • [callback]
)
chainable

关闭对话框

Parameters:

  • [callback] Function optional

    回调

Example:

       uiDialog.close();
                                                

create

(
  • option
)
chainable

动态增加对话框

Parameters:

Example:

       // 1.5.0 支持公共参数, 1.4.8 参数需要在create 里面
                                                       var dialog = bui.dialog();
                                                       // 先创建再打开
                                                       var dialogobj = dialog.create({ title:"标题", content:"提醒内容"})
                                                
                                                           dialogobj.open();
                                                

destroy

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1541

Available since 1.4.2

[销毁控件]

Example:

       //销毁
                                                       uiDialog.destroy();
                                                

disableClose

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1174

Available since 1.6.5

禁止关闭

Example:

       var status = uiDialog.disableClose();
                                                

disableOpen

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1144

Available since 1.6.5

禁止打开

Example:

       var status = uiDialog.disableOpen();
                                                

enableClose

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1189

Available since 1.6.5

允许关闭

Example:

       var status = uiDialog.enableClose();
                                                

enableOpen

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1159

Available since 1.6.5

允许打开

Example:

       var status = uiDialog.enableOpen();
                                                

fullscreen

(
  • [bool]
  • [callback]
)

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1078

Available since 1.7.3

全屏

Parameters:

  • [bool] Boolean optional

    是否全屏

  • [callback] Function optional

    回调

Example:

       // 开启
                                                       uiDialog.fullscreen();
                                                       // 关闭
                                                       uiDialog.fullscreen(false);
                                                

hide

(
  • [callback]
)
chainable

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:544

Available since 1.7.6

无动画关闭对话框

Parameters:

  • [callback] Function optional

    回调

Example:

       uiDialog.hide();
                                                

init

(
  • [option]
)
chainable

初始化方法,用于重新初始化结构,事件只初始化一次

Parameters:

  • [option] Object optional

    参数控件本身

isFullscreen

() Boolean

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1112

Available since 1.7.5

是否全屏

Returns:

Boolean:

是否全屏

Example:

       // 状态
                                                       let status = uiDialog.isFullscreen();
                                                

isOpen

()

检测窗口是否打开

Example:

       var status = uiDialog.isOpen();
                                                

maxmize

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:956

Available since 1.7.3

最大化

Example:

       uiDialog.maxmize();
                                                

minimize

(
  • [option]
)

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:849

Available since 1.7.3

最小化

Parameters:

  • [option] Object optional
    • [title] Number optional

      自定义缩小后的标题,非必需

    • [needRemove] Boolean optional

      是否允许移除图标

Example:

       uiDialog.minimize();
                                                
                                                       uiDialog.minimize({
                                                           title:"自定义标题"
                                                       });
                                                

modify

(
  • option]
  • [option.width]
  • [option.height]
  • [option.title]
  • [option.conent]
)

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1590

Available since 1.8.2

修改一些不需要重新渲染的参数

Parameters:

  • option] Object
  • [option.width] String optional

    宽度

  • [option.height] String optional

    高度

  • [option.title] String optional

    头部内容

  • [option.conent] String optional

    中间滚动内容

Example:

       //获取依赖控件
                                                       var uiDialogWidget = uiDialog.widget("toggle");
                                                

open

(
  • [callback]
)
chainable

打开对话框

Parameters:

  • [callback] Function optional

    回调

Example:

       uiDialog.open();
                                                

option

(
  • [key]
  • [value]
)
chainable

获取设置参数

Parameters:

  • [key] String | object optional

    不传则获取所有参数, 类型为string,没有第2个参数则获取某个参数

  • [value] String | number | boolean | function optional

    设置参数的时候要传,设置多个参数不用传,获取参数的时候也不用传

Example:

       //获取所有参数
                                                        //获取所有参数
                                                       var option = uiDialog.option();
                                                
                                                       //获取某个参数
                                                       var id = uiDialog.option( "id" );
                                                
                                                       //修改一个参数
                                                       uiDialog.option( "fullscreen",true );
                                                
                                                       //修改多个参数
                                                       uiDialog.option( {"fullscreen":true} );
                                                

remove

() chainable

移除对话框

Example:

       uiDialog.remove();
                                                

removebar

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1018

Available since 1.7.3

移除最小化窗口

Example:

       uiDialog.removebar();
                                                

render

(
  • [option]
)

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1335

Available since 1.8.0

渲染模板内容

Parameters:

  • [option] Object optional
    • [id] String optional

      填充到哪个id下,默认是当前id,可以不用传

    • [content] String optional

      填充的内容,可以是html

Example:

       uiDialog.render({
                                                           content:"自定义标题"
                                                       });
                                                

resize

(
  • [option]
)

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:746

Available since 1.7.3

重新设置高度

Parameters:

  • [option] Object optional
    • [width] Number optional

      宽度

    • [height] Number optional

      高度

Example:

revert

()

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:987

Available since 1.7.3

还原大小

Example:

       uiDialog.revert();
                                                

scroll

(
  • [bool]
  • [callback]
)

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1042

Available since 1.7.3

开启滚动条

Parameters:

  • [bool] Boolean optional

    是否开启滚动条

  • [callback] Function optional

    回调

Example:

       // 开启
                                                       uiDialog.scroll();
                                                       // 关闭
                                                       uiDialog.scroll(false);
                                                

show

(
  • [callback]
)
chainable

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:526

Available since 1.7.6

无动画打开对话框

Parameters:

  • [callback] Function optional

    回调

Example:

       uiDialog.show();
                                                

toggle

(
  • [onOpen]
  • [onClose]
)
chainable

切换显示, 默认点一次打开,点2次关闭

Parameters:

  • [onOpen] Function optional

    打开的回调, 非必需

  • [onClose] Function optional

    关闭的回调, 非必需

Example:

       $("#id").click(function(){
                                                           // 1. 只做切换
                                                           uiDialog.toggle();
                                                
                                                           // 2. 切换带回调
                                                           uiDialog.toggle(function(){
                                                               // 打开的回调
                                                           },function(){
                                                               // 关闭的回调
                                                           });
                                                       })
                                                

top

(
  • [index]
)
chainable

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1510

Available since 1.6.2

置顶

Parameters:

  • [index] Number optional

    设置指定层级

Example:

       $("#id").click(function(){
                                                           // 1. 只做切换
                                                           uiDialog.top();
                                                
                                                       })
                                                

widget

(
  • [name]
)

获取依赖的控件

Parameters:

  • [name] String optional

    依赖 toggle 控件

Example:

       //获取依赖控件
                                                       var uiDialogWidget = uiDialog.widget("toggle");
                                                

Events

off

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1693

Available since 1.3.0

为控件取消绑定事件

Event Payload:

  • [type] String optional

    事件类型: "open"(打开的窗口时候触发) | "close"(关闭窗口的时候触发)

  • [callback] Function optional

    绑定的事件, this 为当前点击的菜单

Example:

       uiDialog.off("open");
                                                

on

Inherited from bui.dialog: src/scripts/ui/bui.dialog.js:1672

Available since 1.3.0

为控件绑定事件

Event Payload:

  • [type] String optional

    事件类型: "open"(打开的窗口时候触发) | "openafter" "afteropen"(打开的动画结束之后触发) | "close"(关闭窗口的时候触发)

  • [callback] Function optional

    绑定的事件, this 为当前点击的菜单

Example:

       uiDialog.on("open",function () {
                                                           // 点击的菜单
                                                           console.log(this);
                                                       });