LayUI 多次加载 引起表单 多次提交

因为主框架是通过 jquery.html() 来加载页面, 会导致layUI表单提交事件多次触发

// load子页面
 window.onhashchange = function () {
            var surl = location.hash.replace("#", "");
            var htmlobj = $.ajax({
                type: "get",
                url: surl,
                dataType: "html",
                async: false
            });
            $(".app-init-container").html(htmlobj.responseText);
            getpagehelp();
        }
 //提交表单
            form.on('submit(save)', function(data) {
                if(!checkproducename(data.field.productId, data.field.productname)) {
                    console.log(6666)
                    return false;
                }

这个问题已经有人在博客里讲过了,挺详细的
链接给你
https://blog.csdn.net/qq_40072737/article/details/80088366