更新时间:2021-12-14 23:07:33
更新说明:
1. 原来的关闭通知最终实现的是display:none 本次更新关闭通知时移除remove元素
2. 新增modal对话框支持如:遮罩,取消/确认回调,自定义按钮名称,单标题无内容,自定义标题等操作。
3. modal内置函数如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | info, success, warning, error, questionmodalInfo: function(opt) { opt.modal == true; opt.type = 'info'; new MESSAGE(opt).render();}, modalSuccess: function(opt) { opt.type = 'success'; opt.modal = true; new MESSAGE(opt).render();}, modalWarning: function(opt) { opt.type = 'warning'; opt.modal = true; new MESSAGE(opt).render();}, modalError: function(opt) { opt.type = 'error'; opt.modal = true; new MESSAGE(opt).render();}, modalQuestion: function(opt) { opt.type = 'question'; opt.modal = true; new MESSAGE(opt).render();}, |
更新时间:2021-12-13 09:23:44
介绍
一个方便的消息通知插件,谢谢支持
演示

代码 记得引入必要文件,模块所使用图标已经内置,更多配置信息查看message.js
图标来源于fontawesome
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | let MESSAGE = function(opt) { this.title = opt.title || '提示'; //标题 this.content = opt.content || false; //内容 如果内容为空则只显示标题 this.position = opt.position || 'center'; //位置 目前只有居中和右 this.closeable = opt.closeable || false; //是否显示关闭按钮 this.type = opt.type || 'info'; //类型 success info warning error this.duration = opt.duration || 5; //倒计时关闭 this.autoclose = opt.autoclose == false ? false : opt.autoclose || true; //是否自动关闭};<script > layui.config({ base: 'module/', version: new Date().getTime() }).extend({ message: 'message/message' }).use(['message'], function() { console.log(layui.message); let msg = layui.message; msg.success({ content: '如果感觉体验良好请给一个免费的star可以吗', closeable: true, autoclose: false, title: '感谢支持' }); layui.util.event('on-event', { cSuccess: function(othis) { msg.success({ content: '一个成功的提示不会自动关闭', closeable: true, autoclose: false, title: '操作成功' }); }, cerror: function(othis) { msg.error({ content: '一个失败的提示不会自动关闭', closeable: true, autoclose: false }); }, cinfo: function(othis) { msg.info({ content: '一个提示不会自动关闭', closeable: true, autoclose: false }); }, cwarning: function(othis) { msg.warning({ content: '一个警告的提示不会自动关闭', closeable: true, autoclose: false, title: '警告' }); }, rinfo: function(othis) { msg.info({ content: '一个成功的提示不会自动关闭', closeable: true, autoclose: false, title: '右侧提示', position: 'right' }); }, rsuccess: function(othis) { msg.success({ content: '一个成功的提示会自动关闭', closeable: true, title: '成功', position: 'right' }); }, rtitle: function(othis) { msg.info({ title: '我只有标题', closeable: true, position: 'right', autoclose: false }); } }); })</script> |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com