mirror of https://github.com/layui/layui
update
parent
4b6ea9efb5
commit
b82537928c
11
src/layui.js
11
src/layui.js
|
@ -53,28 +53,25 @@
|
||||||
}();
|
}();
|
||||||
|
|
||||||
// 异常提示
|
// 异常提示
|
||||||
var error = function(msg, type, isDebug) {
|
var error = function(msg, type) {
|
||||||
type = type || 'log';
|
type = type || 'log';
|
||||||
msg = '[Layui warn]: ' + msg;
|
msg = '[Layui warn]: ' + msg;
|
||||||
|
|
||||||
if (window.console) {
|
if (window.console) {
|
||||||
console[type] ? console[type](msg) : console.log(msg);
|
console[type] ? console[type](msg) : console.log(msg);
|
||||||
}
|
}
|
||||||
if(isDebug && layui && layui.cache.debug) {
|
|
||||||
debugger
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
var warned = Object.create(null);
|
var warned = Object.create(null);
|
||||||
|
|
||||||
var errorOnce = function (msg, type, isDebug) {
|
var errorOnce = function (msg, type) {
|
||||||
if(warned._size && warned._size > 500){
|
if(warned._size && warned._size > 100){
|
||||||
warned = Object.create(null);
|
warned = Object.create(null);
|
||||||
warned._size = 0;
|
warned._size = 0;
|
||||||
}
|
}
|
||||||
if (!warned[msg]) {
|
if (!warned[msg]) {
|
||||||
warned[msg] = true;
|
warned[msg] = true;
|
||||||
warned._size = (warned._size || 0) + 1;
|
warned._size = (warned._size || 0) + 1;
|
||||||
error(msg, type, isDebug)
|
error(msg, type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,10 +274,10 @@ layui.define('lay', function(exports) {
|
||||||
var isFallback = defaultValue === value || value === path;
|
var isFallback = defaultValue === value || value === path;
|
||||||
var isNotFound = !value || isFallback;
|
var isNotFound = !value || isFallback;
|
||||||
if (isNotFound) {
|
if (isNotFound) {
|
||||||
hint.errorOnce("Not found '" + path + "' key in '" + locale + "' locale messages.", 'warn', true);
|
hint.errorOnce("Not found '" + path + "' key in '" + locale + "' locale messages.", 'warn');
|
||||||
}
|
}
|
||||||
if (isFallback) {
|
if (isFallback) {
|
||||||
hint.errorOnce("Fallback to default message for key: '" + path + "'", 'warn', true);
|
hint.errorOnce("Fallback to default message for key: '" + path + "'", 'warn');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue