pull/2745/head
sight 2025-06-30 10:07:02 +08:00
parent 4b6ea9efb5
commit b82537928c
2 changed files with 6 additions and 9 deletions

View File

@ -53,28 +53,25 @@
}();
// 异常提示
var error = function(msg, type, isDebug) {
var error = function(msg, type) {
type = type || 'log';
msg = '[Layui warn]: ' + msg;
if (window.console) {
console[type] ? console[type](msg) : console.log(msg);
}
if(isDebug && layui && layui.cache.debug) {
debugger
}
};
var warned = Object.create(null);
var errorOnce = function (msg, type, isDebug) {
if(warned._size && warned._size > 500){
var errorOnce = function (msg, type) {
if(warned._size && warned._size > 100){
warned = Object.create(null);
warned._size = 0;
}
if (!warned[msg]) {
warned[msg] = true;
warned._size = (warned._size || 0) + 1;
error(msg, type, isDebug)
error(msg, type)
}
}

View File

@ -274,10 +274,10 @@ layui.define('lay', function(exports) {
var isFallback = defaultValue === value || value === path;
var isNotFound = !value || isFallback;
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) {
hint.errorOnce("Fallback to default message for key: '" + path + "'", 'warn', true);
hint.errorOnce("Fallback to default message for key: '" + path + "'", 'warn');
}
}