Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/420.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从extJS 4迁移到extJS 5:属性未定义_Javascript_Extjs - Fatal编程技术网

Javascript 从extJS 4迁移到extJS 5:属性未定义

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

在尝试将我的应用程序从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');
    }
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>