From e893e9617b5d1b0c6e9291fb925be0b34c4537f6 Mon Sep 17 00:00:00 2001 From: sight <26325820+Sight-wcg@users.noreply.github.com> Date: Thu, 26 Jun 2025 15:29:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(i18n):=20=E4=BF=AE=E5=A4=8D=20table=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=20key=20=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layui.js | 22 ---------------------- src/modules/table.js | 8 ++++++-- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/layui.js b/src/layui.js index b4498ea0..c99b5c06 100644 --- a/src/layui.js +++ b/src/layui.js @@ -120,28 +120,6 @@ }; } - // Array.prototype.map - // 引用自 https://github.com/inexorabletash/polyfill/blob/716a3f36ca10fad032083014faf1a47c638e2502/es5.js#L300-L345 - if (!Array.prototype.map) { - Array.prototype.map = function (fun /*, thisp */) { - if (this === void 0 || this === null) { throw TypeError(); } - - var t = Object(this); - var len = t.length >>> 0; - if (typeof fun !== "function") { throw TypeError(); } - - var res = []; res.length = len; - var thisp = arguments[1], i; - for (i = 0; i < len; i++) { - if (i in t) { - res[i] = fun.call(thisp, t[i], i, t); - } - } - - return res; - }; - } - /** * 节点加载事件 * @param {HTMLElement} node - script 或 link 节点 diff --git a/src/modules/table.js b/src/modules/table.js index 967cb339..7dd21ef1 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -193,7 +193,7 @@ layui.define(['lay', 'i18n', 'laytpl', 'laypage', 'form', 'util'], function(expo ,'{{# } else { }}' ,'{{-item2.title||""}}' ,'{{# if(isSort){ }}' - ,'' + ,'' ,'{{# } }}' ,'{{# } }}' ,'' @@ -422,7 +422,11 @@ layui.define(['lay', 'i18n', 'laytpl', 'laypage', 'form', 'util'], function(expo tagStyle: 'legacy' }).render({ data: options, - index: that.index //索引 + index: that.index, //索引 + i18nMessages: { + 'table_sort_asc': i18n.$t('table.sort.asc'), + 'table_sort_desc': i18n.$t('table.sort.desc') + } })); // 初始化样式