现在的位置: 首页 > 综合 > 正文

extjs4.1 desktop 桌面窗口切换,放大缩小卡死问题解决

2014年06月01日 ⁄ 综合 ⁄ 共 1052字 ⁄ 字号 评论关闭

extjs4.1 desktop 桌面窗口切换,放大缩小,关闭,多操作几次,窗口常会卡死在那, 错误代码:Uncaught TypeError: Cannot read property ‘dom’ of null  或
Uncaught TypeError: Cannot read property ‘dom’ of undefined   定位到 desktop.js文件的
last.el.dom 这行代码:

  updateActiveWindow: function () {
        var me = this, activeWindow = me.getActiveWindow(), last = me.lastActiveWindow;
        if (activeWindow === last) {
            return;
        }

        if (last) {
            if (last.el.dom) {
                last.addCls(me.inactiveWindowCls);
                last.removeCls(me.activeWindowCls);
            }
            last.active = false;
        }

解决办法: 判断 last.el 是否为空 如果为空,没有对象,则中止窗口继续操作

 

    updateActiveWindow: function () {
        var me = this, activeWindow = me.getActiveWindow(), last = me.lastActiveWindow;
        if (activeWindow === last) {
            return;
        }

        if (last) {
            if (Ext.isEmpty(last.el)) { return; }; //增加这一行
            if (last.el.dom) {
                last.addCls(me.inactiveWindowCls);
                last.removeCls(me.activeWindowCls);
            }
            last.active = false;
        }

增加一行代码 if (Ext.isEmpty(last.el)) { return; };  问题解决,大大减少卡死现象。

 

 

 

 

 

 

 

抱歉!评论已关闭.