From 6b2b6a8fa4032995aafc2f648e401587708fe820 Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <285584806@qq.com> Date: Sun, 19 Jun 2022 11:03:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4reloadData=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index 56b8eba3..a00631b7 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -2094,7 +2094,8 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ }; //需要重新render的参数名单 - var dataParams = ['data', 'url', 'where', 'page', 'request', 'response']; + var dataParams = ['data', 'url', 'where', 'page', 'request', 'response', 'parseData']; + var dataParamsRegExp = new RegExp('^(' + dataParams.join('|') + ')$') //重载数据 options只允许跟数据请求相关的配置信息 table.reloadData = function(id, options, deep){ var config = getThisTableConfig(id); //获取当前实例配置项 @@ -2110,7 +2111,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ } //过滤options只留下跟数据请求相关的参数 layui.each(options, function (_key, _value) { - if (dataParams.indexOf(_key) === -1) { + if (!dataParamsRegExp.test(_key)) { delete options[_key]; } });