From ece23116913de57e9e33b5d55da1af4e9cea43f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 23 Feb 2023 00:25:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20table=20=E7=9A=84=20`page/?= =?UTF-8?q?limit`=20=E5=B1=9E=E6=80=A7=EF=BC=8C=E5=BD=93=20`page`=20?= =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E6=97=B6=EF=BC=8C=E5=88=99=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=86=8D=E5=90=91=E5=90=8E=E7=AB=AF=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E6=AD=A4=E4=BA=8C=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/table.js b/src/modules/table.js index 4138febe..f5f5ff0d 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -343,7 +343,7 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ }, options.response); //如果 page 传入 laypage 对象 - if(typeof options.page === 'object'){ + if(options.page !== null && typeof options.page === 'object'){ options.limit = options.page.limit || options.limit; options.limits = options.page.limits || options.limits; that.page = options.page.curr = options.page.curr || 1; @@ -927,8 +927,11 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ if(options.url){ // Ajax请求 var params = {}; - params[request.pageName] = curr; - params[request.limitName] = options.limit; + // 当 page 开启,默认自动传递 page、limit 参数 + if(options.page){ + params[request.pageName] = curr; + params[request.limitName] = options.limit; + } // 参数 var data = $.extend(params, options.where);