[SkylerAI]零碎知识点13-JS阻止事件冒泡和默认行为

参考链接:https://www.cnblogs.com/yuqingfamily/p/5940369.html

亲测如下:
Framework7中若使用以下方式绑定事件

var bindings=[
                {
                    element:".advertImg",
                    event:"click",
                    handler:function () {
                        myApp.closeModal(popover);
                        window.location.href="xxx"
                    }
                },
                {
                    element:".closeImg",
                    event:"click",
                    handler:function (e) {
                        myApp.closeModal(popover);
                        e.stopPropagation();
                    }
                }
            ];
appFunc.bindEvents(bindings);

return false; 无法阻止冒泡。
e.stopPropagation(); 可以阻止冒泡。

你可能感兴趣的:([SkylerAI]零碎知识点13-JS阻止事件冒泡和默认行为)