var win = Ext.create('Ext.window.Window', {
title: "Window",
modal:true,
width: 570,
height: 440,
layout: 'card',
items:[{
xtype: "panel",
border: true,
bodyBorder: true,
title: 'Panel',
bodyStyle: {
"background": "linear-gradient(to left, #fff , #6799ff)"
},
id: 'PanelID',
items:[{
xtype: 'box',
id: 'BoxID',
title:'Box',
width: 558,
height: 325,
autoEl: {
tag: 'iframe'
},
listeners: {
'boxready': function() {
var popWindowdoc = Ext.getCmp('BoxID').el.dom.contentDocument;
$(popWindowdoc.body).append('<div id="t" tabindex="0"/>');
$(popWindowdoc.getElementById('t')).append('This is Test');
}
}
}]
}
]
});
win.show();
该代码在chrome中运行良好,并且在我的窗口中显示“ This is Test”。
但是在firefox中,我没有收到任何文本,也没有发生错误。我认为这是一个渲染问题。
有谁让我知道在这种情况下我将如何获得短信?
最佳答案
Firefox将解释您的代码的这一部分,如果可能的话,您只需要用一组方括号[{ ...}]
的方式来重构代码,看看有2个items
怎么办?只能是1 items
items:[{
xtype: "panel",
border: true,
bodyBorder: true,
title: 'Panel',
bodyStyle: {
"background": "linear-gradient(to left, #fff , #6799ff)"
},
id: 'PanelID',
items:[{
xtype: 'box',
id: 'BoxID',
title:'Box',
width: 558,
height: 325,
autoEl: {
tag: 'iframe'
},
listeners: {
'boxready': function() {
var popWindowdoc = Ext.getCmp('BoxID').el.dom.contentDocument;
$(popWindowdoc.body).append('<div id="t" tabindex="0"/>');
$(popWindowdoc.getElementById('t')).append('This is Test');
}
}
}]