多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# **弹窗调用** 注意:如果单单只使用弹窗的话请引入layer.js即可,jq要先引用 ~~~ <script src="{$addon_static_path}public/layer/layer.js"></script> ~~~ 代码示例 1.使用自动关闭的弹出调用layer.msg ~~~ layer.msg('用户名不得为空',{ title:'错误提示', icon:2, time:2000, offset: 'auto', skin:'layui-layer-lan' }); ~~~ 2.使用不自动关闭的弹窗调用layer.alert ~~~ layer.alert('用户名不得为空',{ title:'错误提示', icon:2, offset: 'auto', skin:'layui-layer-lan' }); ~~~ **一些常用参数说明**(详细说明请看官方文档https://www.layui.com/doc/modules/layer.html) | 值 | 备注 | | --- | --- | | title | 标题 | | icon| 图标,0-6,信息提示请使用8 | | skin | 样式类名,可自定义,官方提供三种主体,1.layui-layer-lan(深蓝),2.layui-layer-molv(墨绿),3白蓝(不写即为默认)| | offset | 默认:垂直水平居中,改变按css参数设置,顺时针四个值,['1px','2px','2px','3px'] | | time| 关闭时间,毫秒级| | btn| 按钮,写多个为数组,['按钮一','按钮二','按钮三']| | 按钮的回调函数 | 具体使用方法请看下面的例子,注意btn有多少个按钮,下面就写多少个回调函数,为一一对应 | 按钮回调函数示例 ~~~ layer.alert('用户名不得为空',{ title:'错误提示', icon:2, offset: 'auto', skin:'layui-layer-lan', btn:['按钮一','按钮二'], btn1:function(){ console.log(1111); }, btn2:function(){ console.log(222); } }); ~~~