From 230b910c64d0d08881d206b9407c6b47f5aadeba Mon Sep 17 00:00:00 2001 From: Pencil-hzp <47172263+Pencil-hzp@users.noreply.github.com> Date: Fri, 31 May 2024 22:17:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(flow):=20=E6=B5=81=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=94=AF=E6=8C=81"=E5=8A=A0=E8=BD=BD=E6=9B=B4=E5=A4=9A"?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=96=87=E6=A1=88=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=20(#1965)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(flow): 流加载支持"加载更多"按钮文案自定义 * docs(flow): 流加载支持"加载更多"按钮文案自定义 * docs(flow): 优化 moreText 选项介绍文案 * docs(flow): 更新文档 --------- Co-authored-by: huangzepeng Co-authored-by: 贤心 <3277200+sentsim@users.noreply.github.com> Co-authored-by: morning-star <26325820+Sight-wcg@users.noreply.github.com> --- docs/flow/detail/options.md | 14 ++++++++++++++ src/modules/flow.js | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/flow/detail/options.md b/docs/flow/detail/options.md index 5b245da2..efe46477 100644 --- a/docs/flow/detail/options.md +++ b/docs/flow/detail/options.md @@ -50,6 +50,20 @@ `true` + + + +moreText + + +设置「加载更多」按钮的文本 + + +string + + +加载更多 + diff --git a/src/modules/flow.js b/src/modules/flow.js index 4824306a..6128e27d 100644 --- a/src/modules/flow.js +++ b/src/modules/flow.js @@ -19,6 +19,7 @@ layui.define('jquery', function(exports){ var scrollElem = $(options.scrollElem || document); // 滚动条所在元素 var threshold = 'mb' in options ? options.mb : 50; // 临界距离 var isAuto = 'isAuto' in options ? options.isAuto : true; // 否自动滚动加载 + var moreText = options.moreText || "加载更多"; // 手动加载时,加载更多按钮文案 var end = options.end || '没有更多了'; // “末页”显示文案 var direction = options.direction || 'bottom'; var isTop = direction === 'top'; @@ -30,7 +31,7 @@ layui.define('jquery', function(exports){ var notDocument = options.scrollElem && options.scrollElem !== document; //加载更多 - var ELEM_TEXT = '加载更多' + var ELEM_TEXT = '' + moreText + '' ,more = $('
'+ ELEM_TEXT +'
'); if(!elem.find('.layui-flow-more')[0]){