Package Exports
- alert-mask
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (alert-mask) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
alert-mask
一个原生的移动端常用弹框小工具;主要包含loading、alert、confirm和message的蒙层,可直接以依赖包的形式映入到H5的移动端项目中。
Installation
请使用 npm安装包
npm install alert-mask引入
import * as popModelServer from 'alert-mask'
或者
import {alert, confirm, loading, message} from 'alert-mask' var popModelServer = require('alert-mask'')注:由于内部是使用原生js创建DOM元素并挂载在body元素的最后,引入时须确保文档HTML文档已加载完成。通常在React、Vue等框架构建的单页面应用程序中,HTML文档以加载完成,在需要使用的地方直接引入使用即可;在独立的多页面(如H5独立活动页)中,注意需要在单个页面的HTML加载完成之后,通常在onload函数中以require按下需加载的方式引入使用。
Explain
alert:
- 参数名称及含义:
- title:String 提示标题 (选填) 默认:"提示"
- content:String 提示内容 (必填)
- confirmText:String 按钮文本 (选填)默认:"确定"
- callback:Function 确认回调函数 (选填)默认值关闭当前弹框,有回调函数会在关闭弹窗后立即执行回调函数
- example:
import {alert} from 'alert-mask'
alert.use({
title: 'alert标题',
content: 'alert内容文本',
confirmText: 'alert按钮文本',
callback: function(){
console.log('alert弹框确定按钮回调函数')
}
})