From 6f09219ce2c234a3f566fb9d8ef382f546856afd 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, 19 Oct 2023 14:18:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20laypage=20=E7=9A=84=20`lim?= =?UTF-8?q?itTemplet`=20=E5=B1=9E=E6=80=A7=EF=BC=8C=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=9D=A1=E7=9B=AE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/laypage.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/modules/laypage.js b/src/modules/laypage.js index 8a86e117..5194a593 100644 --- a/src/modules/laypage.js +++ b/src/modules/laypage.js @@ -156,15 +156,24 @@ layui.define(function(exports){ // 每页条数 limit: function(){ - var options = ['']; + var template = function(item) { + var def = item +' 条/页'; + return typeof config.limitTemplet === 'function' + ? (config.limitTemplet(item) || def) + : def; + }; + + // 条目选项列表 layui.each(config.limits, function(index, item){ - options.push( - '' + elemArr.push( + '' ); }); - return options.join('') +''; + + return elemArr.join('') +''; }(), // 刷新当前页