E_INVALID_PAR_TYPE 在页面加载期间触发(cldr,全球化)
E_INVALID_PAR_TYPE is triggered during the page load (cldr, globalize)
我们正在尝试使用 cldr/globalize,不幸的是,在加载页面期间触发了错误。
调试代码根本没有帮助,我无法弄清楚是哪个输入字段产生了问题
您需要更多信息吗?您需要更多代码吗?告诉我
JavaScript,载入cldr数据,设置locale为'en'
$(document).ready(function () {
//
// download json files on https://github.com/unicode-cldr?page=2
// how to setup globalize, cldr and json data: http://johnnyreilly.github.io/globalize-so-what-cha-want
var locale = 'en'; // TODO: manage the localization based on user preferences (browser)
//
$.when(
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/likelySubtags.json"),
$.getJSON("/Scripts/plugins/cldr-numbers-full-30.0.2/main/" + locale + "/numbers.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/numberingSystems.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/plurals.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/ordinals.json"),
$.getJSON("/Scripts/plugins/cldr-numbers-full-30.0.2/main/" + locale + "/currencies.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/currencyData.json"),
$.getJSON("/Scripts/plugins/cldr-dates-full-30.0.2/main/" + locale + "/ca-gregorian.json"),
$.getJSON("/Scripts/plugins/cldr-dates-full-30.0.2/main/" + locale + "/timeZoneNames.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/timeData.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/weekData.json"),
$.getJSON("/Scripts/plugins/cldr-dates-full-30.0.2/main/" + locale + "/dateFields.json"),
$.getJSON("/Scripts/plugins/cldr-units-full-30.0.2/main/" + locale + "/units.json"),
console.log("JSONs loaded")
).then(function () {
console.log("start slicing");
return [].slice.apply(arguments, [0]).map(function (result) {
console.log("slicing done");
return (typeof result === 'undefined' ? null : result[0]);
});
}).then(Globalize.load).then(function () {
Globalize.locale(locale);
console.log("Locale set to " + locale);
}).then(console.log("LOADED EVERYTHING"));
});
HTML ,加载 javascripts
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>StratEx | Project management</title>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css">
<link href="/Scripts/plugins/jquery-ui-1.11.4/jquery-ui.css" rel="stylesheet">
<link href="/Content/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/Content/bootstrap-3.3.7/css/bootstrap.css" rel="stylesheet">
<link href="/Content/animate.css" rel="stylesheet">
<link href="/Content/style.css" rel="stylesheet">
<link href="/Content/themes/redmond/jquery-ui-1.10.3.custom.min.css" rel="stylesheet">
<script type="application/javascript" async="" defer="" src="https://by2.uservoice.com/t2/ID/web/ID/track.js?_=TIMESTAMP&s=1&c=__uvSessionData0&d=HASH"></script>
<script type="text/javascript" async="" src="//widget.uservoice.com/CODE.js"></script><script async="" src="//www.google-analytics.com/analytics.js"></script>
<script
src="/Scripts/jquery-2.2.1.js"></script>
<script src="/Scripts/plugins/cldrjs-0.4.7/dist/cldr.js"></script>
<script src="/Scripts/plugins/cldrjs-0.4.7/dist/cldr/event.js"></script>
<script src="/Scripts/plugins/cldrjs-0.4.7/dist/cldr/supplemental.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/number.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/plural.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/message.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/currency.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/date.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/relative-time.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/unit.js"></script>
<script src="/Scripts/plugins/jquery-validation-1.15.1/dist/jquery.validate.js"></script>
<script src="/Scripts/plugins/jquery-validation-unobtrusive-3.2.6/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/plugins/jquery-ajax-unobtrusive-3.2.4/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/plugins/jquery-validation-globalize-1.0.0/jquery.validate.globalize.js"></script>
<script src="/Scripts/plugins/jquery-ui-1.11.4/jquery-ui.js"></script>
<script src="/Content/bootstrap-3.3.7/js/bootstrap.js"></script>
</head>
我相信这与您的切片有关...有一种情况是您 return null
,这就是 Globalize.load
所抱怨的(它需要一个普通对象,例如,{}
,但它变成了 null
).
问题是因为 console.log 在 arguments
中附加了一个项目 undefined
。
我通过以下方式更正了错误:
- 删除
, console.log("JSONs loaded")
- 修正
return (typeof result === 'undefined' ? null : result[0]);
由 return result[0];
我们正在尝试使用 cldr/globalize,不幸的是,在加载页面期间触发了错误。
调试代码根本没有帮助,我无法弄清楚是哪个输入字段产生了问题
您需要更多信息吗?您需要更多代码吗?告诉我
JavaScript,载入cldr数据,设置locale为'en'
$(document).ready(function () {
//
// download json files on https://github.com/unicode-cldr?page=2
// how to setup globalize, cldr and json data: http://johnnyreilly.github.io/globalize-so-what-cha-want
var locale = 'en'; // TODO: manage the localization based on user preferences (browser)
//
$.when(
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/likelySubtags.json"),
$.getJSON("/Scripts/plugins/cldr-numbers-full-30.0.2/main/" + locale + "/numbers.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/numberingSystems.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/plurals.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/ordinals.json"),
$.getJSON("/Scripts/plugins/cldr-numbers-full-30.0.2/main/" + locale + "/currencies.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/currencyData.json"),
$.getJSON("/Scripts/plugins/cldr-dates-full-30.0.2/main/" + locale + "/ca-gregorian.json"),
$.getJSON("/Scripts/plugins/cldr-dates-full-30.0.2/main/" + locale + "/timeZoneNames.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/timeData.json"),
$.getJSON("/Scripts/plugins/cldr-core-30.0.2/supplemental/weekData.json"),
$.getJSON("/Scripts/plugins/cldr-dates-full-30.0.2/main/" + locale + "/dateFields.json"),
$.getJSON("/Scripts/plugins/cldr-units-full-30.0.2/main/" + locale + "/units.json"),
console.log("JSONs loaded")
).then(function () {
console.log("start slicing");
return [].slice.apply(arguments, [0]).map(function (result) {
console.log("slicing done");
return (typeof result === 'undefined' ? null : result[0]);
});
}).then(Globalize.load).then(function () {
Globalize.locale(locale);
console.log("Locale set to " + locale);
}).then(console.log("LOADED EVERYTHING"));
});
HTML ,加载 javascripts
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>StratEx | Project management</title>
<meta http-equiv="X-UA-Compatible" content="IE=EDGE">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css">
<link href="/Scripts/plugins/jquery-ui-1.11.4/jquery-ui.css" rel="stylesheet">
<link href="/Content/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/Content/bootstrap-3.3.7/css/bootstrap.css" rel="stylesheet">
<link href="/Content/animate.css" rel="stylesheet">
<link href="/Content/style.css" rel="stylesheet">
<link href="/Content/themes/redmond/jquery-ui-1.10.3.custom.min.css" rel="stylesheet">
<script type="application/javascript" async="" defer="" src="https://by2.uservoice.com/t2/ID/web/ID/track.js?_=TIMESTAMP&s=1&c=__uvSessionData0&d=HASH"></script>
<script type="text/javascript" async="" src="//widget.uservoice.com/CODE.js"></script><script async="" src="//www.google-analytics.com/analytics.js"></script>
<script
src="/Scripts/jquery-2.2.1.js"></script>
<script src="/Scripts/plugins/cldrjs-0.4.7/dist/cldr.js"></script>
<script src="/Scripts/plugins/cldrjs-0.4.7/dist/cldr/event.js"></script>
<script src="/Scripts/plugins/cldrjs-0.4.7/dist/cldr/supplemental.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/number.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/plural.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/message.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/currency.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/date.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/relative-time.js"></script>
<script src="/Scripts/plugins/globalize-1.1.2/dist/globalize/unit.js"></script>
<script src="/Scripts/plugins/jquery-validation-1.15.1/dist/jquery.validate.js"></script>
<script src="/Scripts/plugins/jquery-validation-unobtrusive-3.2.6/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/plugins/jquery-ajax-unobtrusive-3.2.4/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/plugins/jquery-validation-globalize-1.0.0/jquery.validate.globalize.js"></script>
<script src="/Scripts/plugins/jquery-ui-1.11.4/jquery-ui.js"></script>
<script src="/Content/bootstrap-3.3.7/js/bootstrap.js"></script>
</head>
我相信这与您的切片有关...有一种情况是您 return null
,这就是 Globalize.load
所抱怨的(它需要一个普通对象,例如,{}
,但它变成了 null
).
问题是因为 console.log 在 arguments
中附加了一个项目 undefined
。
我通过以下方式更正了错误:
- 删除
, console.log("JSONs loaded")
- 修正
return (typeof result === 'undefined' ? null : result[0]);
由return result[0];