From 8f782fb11ed931995dcdd3260406034d769a5fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Tue, 21 Nov 2023 23:50:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20util=20=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/util.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/examples/util.html b/examples/util.html index 5d57c131..f1d1d0aa 100644 --- a/examples/util.html +++ b/examples/util.html @@ -18,6 +18,13 @@ body{padding: 50px;} +

+ +
+ + +
+
@@ -120,6 +127,20 @@ layui.use(['lay', 'util', 'layer'], function(){ trigger: 'mouseenter' }); + // 自定义触发事件的委托元素 + util.on({ + // 此处与委托在 body 上的事件共用了 e1 名称,以测试事件冒泡 + e1: function(othis, e){ + this.innerHTML = 'click: '+ (Math.random()*100000 | 0); + layui.stope(e); // 阻止事件冒泡 + }, + e5: function(othis) { + this.innerHTML = 'click: '+ (Math.random()*100000 | 0); + } + }, { + elem: '#ID-util-on-test' + }); + // 倒计时 var countdown = util.countdown({