Module: layer

请使用whale.layer模块内调用

Source:

Methods


<inner> close(idxOrDom)

关闭弹层

Parameters:
Name Type Description
idxOrDom Number | Object

要关闭的弹层dom或者对应idx

Source:
Example
layer.close(1);

<inner> closeLoading()

关闭加载层, 和layer.showLoading配套使用

Source:

<inner> open(config)

弹出弹层

Parameters:
Name Type Description
config Object

配置

Properties:
Name Type Description
config.content String

弹出层的innerHTML

config.sel String

弹出层选择器

Source:
Example
//使用选择器弹出
layer.open({
    sel: '#poplayer'
});
//传入content参数
layer.open({
    content: '<div class="poplayer">我是弹层</div>'
});

<inner> showLoading(text)

显示加载层

Parameters:
Name Type Description
text String

加载文字

Source:
Example
layer.showLoading('正在加载');

<inner> showMsgBox(title, content, sureOrCancelText, sureOrCancelFunc, sureText, sureFunc)

显示MessageBox

Parameters:
Name Type Description
title String

标题

content String

内容

sureOrCancelText String

确定或者取消按钮

sureOrCancelFunc function

确定或者取消按钮的回调

sureText String

确定按钮

sureFunc function

确定按钮回调

Source:
Example
layer.showMsgBox('温馨提示','确定删除吗','确定', null, '取消', null);
layer.showMsgBox('温馨提示','确定删除吗','确定', function(){});

<inner> showToast(content, delay, style)

弹出Toast(从中间弹出)

Parameters:
Name Type Description
content String

提示内容

delay Number

显示时间(秒), 只能传递3-5之内的数字

style String

附加样式

Source:
Example
//一个参数
layer.showToast2('通知成功');
//2个参数
layer.showToast2('通知成功',3);

<inner> showToast2(content, delay, style)

弹出Toast(从底部弹出)

Parameters:
Name Type Default Description
content String

提示内容

delay Number 3

显示时间(秒), 只能传递3-5之内的数字

style String

附加样式

Source:
Example
//一个参数
layer.showToast2('通知成功');
//2个参数
layer.showToast2('通知成功',3);