From b7a36cb0d62c91fa8a0b0110a4f7bcc7fc19e2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B2=81=E6=9C=88=E5=B0=8F=E5=81=B7?= <470459819@qq.com> Date: Tue, 5 Jul 2022 03:12:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtable=E5=92=8Cform=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 7 +++++-- src/modules/table.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/form.js b/src/modules/form.js index 35166efb..dd0c92ad 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -670,6 +670,7 @@ layui.define('layer', function(exports){ // elem 即要验证的区域表单选择器 - return true or false Form.prototype.validate = function(elem){ + var that = this; var stop = null; //验证不通过状态 var verify = form.config.verify; //验证规则 var DANGER = 'layui-form-danger'; //警示样式 @@ -680,8 +681,10 @@ layui.define('layer', function(exports){ if(!elem[0]) return !0; // 若节点不存在特定属性,则查找容器内有待验证的子节点 - if(!elem.attr('lay-verify')){ - elem = elem.find('*[lay-verify]'); + if(elem.attr('lay-verify') === undefined){ // 如果校验的是一个不带验证规则的容器,校验内部的verify节点 + if (that.validate(elem.find('*[lay-verify]')) === false) { + return false; + } } //开始校验 diff --git a/src/modules/table.js b/src/modules/table.js index b5812a0c..bbe36362 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -796,6 +796,8 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){ that.layPage.find(ELEM_PAGE_VIEW).addClass(HIDE_V); table.cache[that.key] = []; //格式化缓存数据 + + that.syncCheckAll(); }; // 初始页码