diff --git a/admin/data/menu.json b/admin/data/menu.json index d4dc82c..7dc856b 100644 --- a/admin/data/menu.json +++ b/admin/data/menu.json @@ -89,6 +89,14 @@ "type": 1, "openType": "_iframe", "href": "view/document/tag.html" + }, + { + "id": 209, + "title": "弹出层", + "icon": "layui-icon layui-icon-face-cry", + "type": 1, + "openType": "_iframe", + "href": "view/document/popup.html" } ] }, diff --git a/component/pear/module/popup.js b/component/pear/module/popup.js new file mode 100644 index 0000000..f5cddc6 --- /dev/null +++ b/component/pear/module/popup.js @@ -0,0 +1,49 @@ +layui.define(['layer', 'jquery', 'element'], function(exports) { + "use strict"; + + var MOD_NAME = 'popup', + $ = layui.jquery, + layer = layui.layer, + element = layui.element; + + var popup = new function() { + + this.success = function(msg) { + layer.msg(msg, { + icon: 1, + time: 1000 + }) + }, + this.failure = function(msg) { + layer.msg(msg, { + icon: 2, + time: 1000 + }) + }, + this.warming = function(msg) { + layer.msg(msg, { + icon: 3, + time: 1000 + }) + }, + this.success = function(msg, callback) { + layer.msg(msg, { + icon: 1, + time: 1000 + }, callback); + }, + this.failure = function(msg, callback) { + layer.msg(msg, { + icon: 2, + time: 1000 + }, callback); + }, + this.warming = function(msg, callback) { + layer.msg(msg, { + icon: 3, + time: 1000 + }, callback); + } + }; + exports(MOD_NAME, popup); +}) diff --git a/component/pear/pear.js b/component/pear/pear.js index aac250f..160f235 100644 --- a/component/pear/pear.js +++ b/component/pear/pear.js @@ -19,5 +19,6 @@ layui.config({ drawer: "drawer", notice: "notice", step:"step", - tag:"tag" + tag:"tag", + popup:"popup" }); diff --git a/view/document/popup.html b/view/document/popup.html new file mode 100644 index 0000000..db7201b --- /dev/null +++ b/view/document/popup.html @@ -0,0 +1,127 @@ + + + + + + + + +
+
+
+
开发环境
+
+ Popup 基于 Layer 的二次封装 +
+
+
+
+
+
+

显示代码

+
+
+								
+								 并
+								
+								 并
+								
+							
+
+
+
+
+
+
+
提示消息
+
+ + + +
+
+
+
+
+
+

显示代码

+
+
+								layui.use(['popup'], function() {
+								    var popup = layui.popup;
+								  
+								    popup.success("成功消息")
+								    popup.failure("失败消息")
+								    popup.warming("警告消息")
+								})
+							
+
+
+
+
+
+
+
回调函数
+
+ + + +
+
+
+
+
+
+

显示代码

+
+
+								layui.use(['popup'], function() {
+								    var popup = layui.popup;
+								  
+								    popup.success("成功消息",callback)
+								    popup.failure("失败消息",callback)
+								    popup.warming("警告消息",callback)
+								})
+							
+
+
+
+
+
+ + + + + diff --git a/view/document/tag.html b/view/document/tag.html index a68d065..bce8bbc 100644 --- a/view/document/tag.html +++ b/view/document/tag.html @@ -186,8 +186,7 @@ - - // 删除响应事件 + tag.on('delete(demo)', function(data) { console.log('删除'); console.log(this); @@ -225,8 +224,7 @@ - - // 新增响应事件 + tag.on('add(demo)', function(data) { console.log('新建'); console.log(this);