Javascript 从extJS 4迁移到extJS 5:属性未定义
在尝试将我的应用程序从ExtJS4更新到ExtJS5时,我遇到了以下错误:Javascript 从extJS 4迁移到extJS 5:属性未定义,javascript,extjs,Javascript,Extjs,在尝试将我的应用程序从ExtJS4更新到ExtJS5时,我遇到了以下错误: Uncaught TypeError: Cannot read property 'get' of undefined 使用以下代码: Ext.onReady(function () { Ext.require([ 'Ext.util.Cookies' ]); top.Dictionary.setDictionary(fr_FR); var formUserNameV
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');
}
Ext.onReady(函数(){
外部要求([
“Ext.util.Cookies”
]);
top.Dictionary.setDictionary(fr_-fr);
var formUserNameValue=“”;
如果(Ext.util.Cookies.get('userName'){
你知道这是从哪里来的吗?Ext.require是异步的,即它将请求发送到服务器并立即返回。你有两个选择,第一个是如果它工作的话会更好:
Ext.require
移动到onReady
<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>