weui.js

Functions

halfScreen(options)halfScreen

半屏自定义内容弹出窗口

show()

显示方法

hide(callback)

隐藏方法

halfScreen(options) ⇒ [halfScreen](#halfScreen)

半屏自定义内容弹出窗口

Kind: global function

Param Type Description
options   配置参数
[options.title] string 窗口标题
[options.container] string 指定窗口被添加到目标容器的 selector
[options.className] string 自定义窗口样式类名
[options.content] string | object 窗口主体内容的 selector,或者 html 内容
[options.close] function 窗口关闭时的回调方法

Example

<script id="gender-content" type="text/html">
 <div>
   <input type="radio" name="gender" value="male" class="weui-check" id="r1" tips="请选择性别" required>
   <input type="radio" name="gender" value="female" class="weui-check" id="r2">
 </div>
</script>

Example

// 常规用法(预置模板)
const half = weui.halfScreen({
   title: '标题',
   content: '#gender-content'
});
half.show();

// 自定义 html
const half = weui.halfScreen({
   content: `<div>
     <h2>标题</h2>
     <p>窗口内容</p>
   </div>`
});
half.show();

show()

显示方法

Kind: global function

hide(callback)

隐藏方法

Kind: global function

Param Type Description
callback function 在关闭动画完成后触发回调,这与 options.close 都会被触发