尝试将我的应用程序从ExtJS4更新到ExtJS5时,出现了以下错误:
Uncaught TypeError: Cannot read property 'get' of undefined
使用以下代码:
Ext.onReady(function () {
Ext.require([
'Ext.util.Cookies'
]);
top.Dictionary.setDictionary(fr_FR);
var formUserNameValue = "";
if (Ext.util.Cookies.get('userName')) { <<<< the error occurs here
formUserNameValue = Ext.util.Cookies.get('userName');
}
还有index.html页面:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Login</title>
<!-- Importation ExtJS -->
<script type="text/javascript" src="../../ext-5.0.0/ext-debug.js"></script>
<link rel="stylesheet" href="../../ext-5.0.0/packages/ext-theme-neptune/build/resources/ext-theme-neptune-all.css"/>
<script type="text/javascript" src="app.js"></script>
<!-- Importation des dictionnaires -->
<script type="text/javascript" src="dictionary/fr_FR.js"></script>
<script type="text/javascript" src="dictionary/en_EN.js"></script>
您是否知道这可能来自哪里?
Ext.require
是异步的,即它将请求发送到服务器并立即返回。您有两个选择,首先,如果可行,它会更好:
Ext.require
前onReady
Ext.syncRequire
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句