layui.form.on 阻止事件冒泡

  1. layui.form.on("XXX",function(){});  此方法会有事件冒泡的现象产生,解决方法是return false  或者使用 layui.stope(),但是我还没搞懂layui.stope()需要传递的参数值,所以在使用的时候会有报错提示。
     1 self.initialFormSubmit = function (param, callBack) {
     2                 layui.use(["form"], function () {
     3                     layui.form.on("submit(submitEdit)", function (data) {
     4                         $.ajax({
     5                             "contentType": "application/json",
     6                             "dataType": "json",
     7                             "type": "post",
     8                             "url": urlConfig().submitPeopleData,
     9                             "data": JSON.stringify(param),
    10                             "success": function (response) {
    11                                 if (response.ResponseCode === "200") {
    12                                     layer.msg(response.Message);
    13                                     callBack();
    14                                 } else {
    15                                     layer.alert(response.Message);
    16                                 }
    17                             }
    18                         });
    19                         return false; 
    20                     });
    21                 });
    22             }
    阻止事件冒泡
posted @ 2018-11-12 13:48  吕金良  阅读(2270)  评论(0编辑  收藏  举报