} obj
+ * @param {string} path
+ * @param {any} defaultValue
+ */
+ function get(obj, path, defaultValue){
+ // 'a[0].b.c' ==> ['a', '0', 'b', 'c']
+ var casePath = path.replace(/\[(\d+)\]/g, '.$1').split('.');
+ var result = obj;
+
+ for(var i = 0; i < casePath.length; i++) {
+ result = result && result[casePath[i]];
+ if(result === null || result === undefined){
+ return defaultValue;
+ }
+ }
+
+ return result;
+ }
+
// export layui
window.layui = new Class();
})(window);
diff --git a/src/modules/code.js b/src/modules/code.js
index 744e5ca1..ea8009f2 100644
--- a/src/modules/code.js
+++ b/src/modules/code.js
@@ -201,7 +201,7 @@ layui.define(['lay', 'util', 'element', 'tabs', 'form'], function(exports){
var tools = {
copy: {
className: 'file-b',
- title: ['复制代码'],
+ title: [layui.$t('复制代码')],
event: function(obj){
var code = util.unescape(finalCode(options.code));
var hasOnCopy = typeof options.onCopy === 'function';
@@ -215,14 +215,14 @@ layui.define(['lay', 'util', 'element', 'tabs', 'form'], function(exports){
if(ret === false) return;
}
- layer.msg('已复制', {icon: 1});
+ layer.msg(layui.$t('已复制'), {icon: 1});
},
error: function() {
if(hasOnCopy){
var ret = options.onCopy(code, false);
if(ret === false) return;
}
- layer.msg('复制失败', {icon: 2});
+ layer.msg(layui.$t('复制失败'), {icon: 2});
}
});
}
@@ -277,7 +277,7 @@ layui.define(['lay', 'util', 'element', 'tabs', 'form'], function(exports){
$.extend(tools, {
'full': {
className: 'screen-full',
- title: ['最大化显示', '还原显示'],
+ title: [layui.$t('最大化显示'), layui.$t('还原显示')],
event: function(obj){
var el = obj.elem;
var elemView = el.closest('.'+ CONST.ELEM_PREVIEW);
@@ -302,7 +302,7 @@ layui.define(['lay', 'util', 'element', 'tabs', 'form'], function(exports){
},
'window': {
className: 'release',
- title: ['在新窗口预览'],
+ title: [layui.$t('在新窗口预览')],
event: function(obj){
util.openWin({
content: finalCode(options.code)
@@ -562,7 +562,7 @@ layui.define(['lay', 'util', 'element', 'tabs', 'form'], function(exports){
// 若开启复制,且未开启预览,则单独生成复制图标
if(options.copy && !options.preview){
var copyElem = $(['',
- '',
+ layui.$t(''),
''].join(''));
// 点击复制
diff --git a/src/modules/colorpicker.js b/src/modules/colorpicker.js
index 215391d4..4cf10d09 100644
--- a/src/modules/colorpicker.js
+++ b/src/modules/colorpicker.js
@@ -285,8 +285,8 @@ layui.define(['jquery', 'lay'], function(exports) {
,''
,''
,''
- ,''
- ,''
+ ,layui.$t('')
+ ,layui.$t('')
,'
'
,''].join(''))
diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js
index f0053cd9..eb53559f 100644
--- a/src/modules/dropdown.js
+++ b/src/modules/dropdown.js
@@ -181,7 +181,7 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports) {
if(options.data.length > 0 ){
eachItemView(elemUl, options.data)
} else {
- elemUl.html('');
+ elemUl.html(layui.$t(''));
}
return elemUl;
};
diff --git a/src/modules/flow.js b/src/modules/flow.js
index e5e4fff7..751d214f 100644
--- a/src/modules/flow.js
+++ b/src/modules/flow.js
@@ -20,8 +20,8 @@ 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 moreText = options.moreText || layui.$t('加载更多'); // 手动加载时,加载更多按钮文案
+ var end = options.end || layui.$t('没有更多了'); // “末页”显示文案
var direction = options.direction || 'bottom';
var isTop = direction === 'top';
diff --git a/src/modules/form.js b/src/modules/form.js
index a16ee41f..ed3dcc28 100644
--- a/src/modules/form.js
+++ b/src/modules/form.js
@@ -31,42 +31,42 @@ layui.define(['lay', 'layer', 'util'], function(exports){
verify: {
required: function(value) {
if (!/[\S]+/.test(value) || value === undefined || value === null) {
- return '必填项不能为空';
+ return layui.$t('必填项不能为空');
}
},
phone: function(value) {
var EXP = /^1\d{10}$/;
if (value && !EXP.test(value)) {
- return '手机号格式不正确';
+ return layui.$t('手机号格式不正确');
}
},
email: function(value) {
var EXP = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (value && !EXP.test(value)) {
- return '邮箱格式不正确';
+ return layui.$t('邮箱格式不正确');
}
},
url: function(value) {
var EXP = /^(#|(http(s?)):\/\/|\/\/)[^\s]+\.[^\s]+$/;
if (value && !EXP.test(value)) {
- return '链接格式不正确';
+ return layui.$t('链接格式不正确');
}
},
number: function(value){
if (value && isNaN(value)) {
- return '只能填写数字';
+ return layui.$t('只能填写数字');
}
},
date: function(value){
var EXP = /^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/;
if (value && !EXP.test(value)) {
- return '日期格式不正确';
+ return layui.$t('日期格式不正确');
}
},
identity: function(value) {
var EXP = /(^\d{15}$)|(^\d{17}(x|X|\d)$)/;
if (value && !EXP.test(value)) {
- return '身份证号格式不正确';
+ return layui.$t('身份证号格式不正确');
}
}
},
@@ -466,7 +466,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 下拉选择框
,select: function(elem){
- var TIPS = '请选择';
+ var TIPS = layui.$t('请选择');
var CLASS = 'layui-form-select';
var TITLE = 'layui-select-title';
var NONE = 'layui-select-none';
@@ -765,7 +765,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
}
}else{
if(none){
- dl.find('.'+NONE)[0] || dl.append('无匹配项
');
+ dl.find('.'+NONE)[0] || dl.append('无匹配项
'));
} else {
dl.find('.'+NONE).remove();
}
@@ -956,7 +956,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
}
});
if (arr.length === 0) {
- arr.push('None');
+ arr.push('None'));
}
return arr.join('');
}();
@@ -1241,7 +1241,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
}
} else {
type ? (
- items[type] ? items[type]() : hint.error('不支持的 "'+ type + '" 表单渲染')
+ items[type] ? items[type]() : hint.error(layui.$t('不支持的 "')+ type + layui.$t('" 表单渲染'))
) : renderItem();
}
return that;
@@ -1367,7 +1367,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
return othis;
}(), {tips: 1});
} else if(verType === 'alert') {
- layer.alert(errorText, {title: '提示', shadeClose: true});
+ layer.alert(errorText, {title: layui.$t('提示'), shadeClose: true});
}
// 若返回的为字符或数字,则自动弹出默认提示框;否则由 verify 方法中处理提示
else if(/\b(string|number)\b/.test(typeof errorText)) {
diff --git a/src/modules/laydate.js b/src/modules/laydate.js
index ae5734b1..de8f301f 100644
--- a/src/modules/laydate.js
+++ b/src/modules/laydate.js
@@ -176,7 +176,7 @@
,showBottom: true //是否显示底部栏
,isPreview: true //是否显示值预览
,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列
- ,lang: 'cn' //语言,只支持cn/en,即中文和英文
+ ,lang: (isLayui && layui.cache.locale) || 'cn' //语言,只支持cn/en,即中文和英文
,theme: 'default' //主题
,position: null //控件定位方式定位, 默认absolute,支持:fixed/absolute/static
,calendar: false //是否开启公历重要节日,仅支持中文版
@@ -191,50 +191,107 @@
//多语言
Class.prototype.lang = function(){
- var that = this
- ,options = that.config
- ,text = {
+ var that = this;
+ var options = that.config;
+ var enMonthShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+ var text = {
cn: {
- weeks: ['日', '一', '二', '三', '四', '五', '六']
- ,time: ['时', '分', '秒']
- ,timeTips: '选择时间'
- ,startTime: '开始时间'
- ,endTime: '结束时间'
- ,dateTips: '返回日期'
- ,month: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二']
- ,tools: {
- confirm: '确定'
- ,clear: '清空'
- ,now: '现在'
+ month: {
+ long: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
+ short: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二']
+ },
+ week: {
+ long: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
+ short: ['日', '一', '二', '三', '四', '五', '六']
+ },
+ time: ['时', '分', '秒'],
+ selectTime: '选择时间',
+ startTime: '开始时间',
+ endTime: '结束时间',
+ selectDate: '选择日期',
+ tools: {
+ confirm: '确定',
+ clear: '清空',
+ now: '现在',
+ reset: '重置'
+ },
+ timeout: {
+ date: '结束日期不能早于开始日期
请重新选择',
+ time: '结束时间不能早于开始时间
请重新选择'
+ },
+ invalidDate: '不在有效日期或时间范围内',
+ formatError: ['日期格式不合法
必须遵循下述格式:
', '
已为你重置'],
+ preview: '当前选中的结果',
+ panelHeaderFormat: {
+ year: function (y) { return y + ' 年' },
+ month: function (m) { return m + ' 月' },
+ monthBeforeYear: false
+ },
+ /** 面板中某些字符串拼接使用 */
+ view: {
+ year: '年',
+ month: '月',
+ week: '周',
+ day: '天'
+ },
+ },
+ en: {
+ month: {
+ long: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+ },
+ week: {
+ long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
+ },
+ time: ['Hours', 'Minutes', 'Seconds'],
+ selectTime: 'Select Time',
+ startTime: 'Start Time',
+ endTime: 'End Time',
+ selectDate: 'Select Date',
+ tools: {
+ confirm: 'Confirm',
+ clear: 'Clear',
+ now: 'Now',
+ reset: 'Reset'
+ },
+ timeout: {
+ date: 'End time cannot be less than start Time
Please re-select',
+ time: 'End time cannot be less than start Time
Please re-select'
+ },
+ invalidDate: 'Invalid date',
+ formatError: ['The date format error
Must be followed:
', '
It has been reset'],
+ preview: 'The selected result',
+ // IE11- Date.prototype.toLocaleDateString 不支持第二个参数,所以这里直接使用英文短格式
+ panelHeaderFormat: {
+ year: function (y) { return y},
+ month: function (m) { return enMonthShort[m - 1]},
+ monthBeforeYear: true
+ },
+ /** 面板中某些字符串拼接使用 */
+ view: {
+ year: '',
+ month: '',
+ week: '',
+ day: ''
}
- ,timeout: '结束时间不能早于开始时间
请重新选择'
- ,invalidDate: '不在有效日期或时间范围内'
- ,formatError: ['日期格式不合法
必须遵循下述格式:
', '
已为你重置']
- ,preview: '当前选中的结果'
- }
- ,en: {
- weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
- ,time: ['Hours', 'Minutes', 'Seconds']
- ,timeTips: 'Select Time'
- ,startTime: 'Start Time'
- ,endTime: 'End Time'
- ,dateTips: 'Select Date'
- ,month: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
- ,tools: {
- confirm: 'Confirm'
- ,clear: 'Clear'
- ,now: 'Now'
- }
- ,timeout: 'End time cannot be less than start Time
Please re-select'
- ,invalidDate: 'Invalid date'
- ,formatError: ['The date format error
Must be followed:
', '
It has been reset']
- ,preview: 'The selected result'
}
};
+
+ if(isLayui){
+ var message = layui.cache.i18nMessages[layui.cache.locale];
+ if(message){
+ text[layui.cache.locale] = message.lay.laydate;
+ }else{
+ window.console && console.log && console.log('layui[laydate]: Locale "' + layui.cache.locale + '" not found. Please add i18n messages for this locale first.');
+ }
+ }
+
return text[options.lang] || text['cn'];
};
Class.prototype.markerOfChineseFestivals = {
+ // 仅 /(zh|cn)/i 生效,不做国际化
'0-1-1': '元旦',
'0-2-14': '情人' ,
'0-3-8': '妇女',
@@ -328,7 +385,7 @@
if (options.weekStart) {
if (!/^[0-6]$/.test(options.weekStart)) {
var lang = that.lang();
- options.weekStart = lang.weeks.indexOf(options.weekStart);
+ options.weekStart = lang.week.short.indexOf(options.weekStart);
if (options.weekStart === -1) options.weekStart = 0;
}
}
@@ -551,7 +608,7 @@
lay.each(new Array(7), function(j){
if(i === 0){
var th = lay.elem('th');
- th.innerHTML = lang.weeks[(j + options.weekStart) % 7];
+ th.innerHTML = lang.week.short[(j + options.weekStart) % 7];
theadTr.appendChild(th);
}
tr.insertCell(j);
@@ -576,7 +633,7 @@
lay(divFooter).html(function(){
var html = [], btns = [];
if(options.type === 'datetime'){
- html.push(''+ lang.timeTips +'');
+ html.push(''+ lang.selectTime +'');
}
if(!(!options.range && options.type === 'datetime') || options.fullPanel){
html.push('')
@@ -585,7 +642,7 @@
lay.each(options.btns, function(i, item){
var title = lang.tools[item] || 'btn';
if(options.range && item === 'now') return;
- if(isStatic && item === 'clear') title = options.lang === 'cn' ? '重置' : 'Reset';
+ if(isStatic && item === 'clear') title = lang.tools.reset;
btns.push(''+ title +'');
});
html.push('');
@@ -1101,7 +1158,7 @@
that.markRender(td, YMD, markers);
}
- if(options.calendar && options.lang === 'cn'){
+ if(options.calendar && /(zh|cn)/i.test(options.lang)){
render(that.markerOfChineseFestivals);
}
@@ -1499,14 +1556,17 @@
if(!that.panelYM) that.panelYM = {};
that.panelYM[index] = {year: dateTime.year, month: dateTime.month};
- if(options.lang === 'cn'){
- lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + ' 年')
- lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + ' 月');
- } else {
- lay(elemYM[0]).attr('lay-type', 'month').html(lang.month[dateTime.month]);
- lay(elemYM[1]).attr('lay-type', 'year').html(dateTime.year);
+ var formatArr = [
+ {type: 'year', value: lang.panelHeaderFormat.year(dateTime.year)},
+ {type: 'month', value: lang.panelHeaderFormat.month(dateTime.month + 1)}
+ ];
+ if(lang.panelHeaderFormat.monthBeforeYear){
+ formatArr = formatArr.reverse();
}
+ lay(elemYM[0]).attr('lay-type', formatArr[0]['type']).html(formatArr[0]['value']);
+ lay(elemYM[1]).attr('lay-type', formatArr[1]['type']).html(formatArr[1]['value']);
+
//初始默认选择器
if(isAlone){ //年、月等独立选择器
if(options.range){
@@ -1518,7 +1578,7 @@
that.list(options.type, 0).list(options.type, 1);
//同步按钮可点状态
- options.type === 'time' ? that.setBtnStatus('时间'
+ options.type === 'time' ? that.setBtnStatus('isTime'
,lay.extend({}, that.systemDate(), that.startTime)
,lay.extend({}, that.systemDate(), that.endTime)
) : that.setBtnStatus(true);
@@ -1595,8 +1655,8 @@
,elemYM = lay(elemHeader[2]).find('span')
,elemCont = that.elemCont[index || 0]
,haveList = lay(elemCont).find('.'+ ELEM_LIST)[0]
- ,isCN = options.lang === 'cn'
- ,text = isCN ? '年' : ''
+ ,isMonthBeforeYear = lang.panelHeaderFormat.monthBeforeYear
+ ,text = lang.view.year
,listYM = that.listYM[index] || {}
,hms = ['hours', 'minutes', 'seconds']
@@ -1644,7 +1704,7 @@
yearNum++;
});
- lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1])
+ lay(elemYM[!isMonthBeforeYear ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1])
.html((startY + text) + ' - ' + (yearNum - 1 + text));
}
@@ -1661,7 +1721,7 @@
};
i + 1 == listYM[1] && lay(li).addClass(THIS);
- li.innerHTML = lang.month[i] + (isCN ? '月' : '');
+ li.innerHTML = lang.month.short[i] + lang.view.month;
ul.appendChild(li);
/*
@@ -1683,7 +1743,7 @@
that.cellRender(li, {year: listYM[0], month: i + 1, date: 1}, 'month');
});
- lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1])
+ lay(elemYM[!isMonthBeforeYear ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1])
.html(listYM[0] + text);
}
@@ -1843,7 +1903,7 @@
,haveSpan = lay(elemHeader[2]).find('.'+ ELEM_TIME_TEXT);
scroll();
- span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.timeTips;
+ span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.selectTime;
lay(that.elemMain[index]).addClass('laydate-time-show');
if(haveSpan[0]) haveSpan.remove();
@@ -1930,7 +1990,7 @@
//是否异常提示
if(tips && isOut) that.hint(
- typeof tips === 'string' ? lang.timeout.replace(/日期/g, tips) : lang.timeout
+ typeof tips === 'string' ? lang.timeout.time : lang.timeout.date
);
}
};
@@ -2320,13 +2380,13 @@
if(lay(btn).hasClass(DISABLED)) return;
that.list('time', 0);
options.range && that.list('time', 1);
- lay(btn).attr('lay-type', 'date').html(that.lang().dateTips);
+ lay(btn).attr('lay-type', 'date').html(that.lang().selectDate);
}
//选择日期
,date: function(){
that.closeList();
- lay(btn).attr('lay-type', 'datetime').html(that.lang().timeTips);
+ lay(btn).attr('lay-type', 'datetime').html(that.lang().selectTime);
}
//清空、重置
@@ -2374,7 +2434,7 @@
: that.startDate && that.endDate && that.newDate(lay.extend({},that.startDate, that.startTime || {})) > that.newDate(lay.extend({},that.endDate, that.endTime || {}));
return isTimeout
- ? that.hint(options.type === 'time' ? lang.timeout.replace(/日期/g, '时间') : lang.timeout)
+ ? that.hint(options.type === 'time' ? lang.timeout.time : lang.timeout.date)
: that.hint(lang.invalidDate);
}
} else {
diff --git a/src/modules/layer.js b/src/modules/layer.js
index e3ae1ae1..a4463e98 100644
--- a/src/modules/layer.js
+++ b/src/modules/layer.js
@@ -34,7 +34,7 @@ var ready = {
events: {resize: {}},
minStackIndex: 0,
minStackArr: [],
- btn: ['确定', '取消'],
+ btn: [layui.$t('确定'), layui.$t('取消')],
// 五种原始层模式
type: ['dialog', 'page', 'iframe', 'loading', 'tips'],
@@ -268,7 +268,7 @@ Class.pt.config = {
shade: 0.3,
fixed: true,
move: doms[1],
- title: '信息',
+ title: layui.$t('信息'),
offset: 'auto',
area: 'auto',
closeBtn: 1,
@@ -1444,7 +1444,7 @@ layer.prompt = function(options, yes){
return layer.open($.extend({
type: 1,
- btn: ['确定','取消'],
+ btn: [layui.$t('确定'),layui.$t('取消')],
content: content,
skin: 'layui-layer-prompt' + skin('prompt'),
maxWidth: win.width(),
@@ -1457,7 +1457,7 @@ layer.prompt = function(options, yes){
yes: function(index){
var value = prompt.val();
if(value.length > (options.maxlength||500)) {
- layer.tips('最多输入'+ (options.maxlength || 500) +'个字符', prompt, {tips: 1});
+ layer.tips(layui.$t('最多输入')+ (options.maxlength || 500) +layui.$t('个字符'), prompt, {tips: 1});
} else {
yes && yes(value, index, prompt);
}
@@ -1571,7 +1571,7 @@ layer.photos = function(options, loop, key){
// 不直接弹出
if (!loop) return;
} else if (data.length === 0){
- return layer.msg('没有图片');
+ return layer.msg(layui.$t('没有图片'));
}
// 上一张
@@ -1819,12 +1819,12 @@ layer.photos = function(options, loop, key){
if (options.toolbar) {
arr.push([
''
].join(''));
}
@@ -1834,7 +1834,7 @@ layer.photos = function(options, loop, key){
arr.push([''].join(''));
}
@@ -1856,9 +1856,9 @@ layer.photos = function(options, loop, key){
}, options));
}, function(){
layer.close(dict.loadi);
- layer.msg('当前图片地址异常,
是否继续查看下一张?', {
+ layer.msg(layui.$t('当前图片地址异常,
是否继续查看下一张?'), {
time: 30000,
- btn: ['下一张', '不看了'],
+ btn: [layui.$t('下一张'), layui.$t('不看了')],
yes: function(){
data.length > 1 && dict.imgnext(true,true);
}
diff --git a/src/modules/laypage.js b/src/modules/laypage.js
index b7707c95..0a7eba91 100644
--- a/src/modules/laypage.js
+++ b/src/modules/laypage.js
@@ -72,8 +72,8 @@ layui.define(function(exports) {
groups = config.pages;
}
- config.prev = 'prev' in config ? config.prev : '上一页'; // 上一页文本
- config.next = 'next' in config ? config.next : '下一页'; // 下一页文本
+ config.prev = 'prev' in config ? config.prev : layui.$t('上一页'); // 上一页文本
+ config.next = 'next' in config ? config.next : layui.$t('下一页'); // 下一页文本
// 计算当前组
var index = config.pages > groups
@@ -100,7 +100,7 @@ layui.define(function(exports) {
// 首页
if(index > 1 && config.first !== false && groups !== 0){
- pager.push(''+ (config.first || 1) +'');
+ pager.push(layui.$t('')+ (config.first || 1) +'');
}
// 计算当前页码组的起始页
@@ -137,7 +137,7 @@ layui.define(function(exports) {
pager.push('...');
}
if(groups !== 0){
- pager.push(''+ (config.last || config.pages) +'');
+ pager.push(layui.$t(''+ (config.last || config.pages) +'');
}
}
@@ -153,7 +153,7 @@ layui.define(function(exports) {
// 数据总数
count: function(){
- var countText = typeof config.countText === 'object' ? config.countText : ['共 ', ' 条'];
+ var countText = typeof config.countText === 'object' ? config.countText : [layui.$t('共')+ ' ', ' ' + layui.$t('条')];
return ''+ countText[0] + config.count + countText[1] +''
}(),
@@ -161,7 +161,7 @@ layui.define(function(exports) {
limit: function(){
var elemArr = ['