这是我打开的面板:
Ext.define("Ez.view.usefullinks.Panel", {
extend: "Ext.panel.Panel",
alias: "widget.usefullinkspanel",
layout: "border",
border: 0,
initComponent: function() {
this.sitePanel = Ext.create("Ez.view.usefullinks.sitePanel");
this.items = [
this.sitePanel
];
this.callParent(arguments);
}
});
以下是导致错误的面板:
Ext.define("Ez.view.usefullinks.sitePanel", {
extend: "Ext.panel.Panel",
alias: "widget.usefullinkssitepanel",
region: "center",
layout: "fit",
initComponent: function() {
this.items= [
'<iframe frameborder="0" src="http://www.google.com" width="100%" height="100%">'
]
}
});
这里有什么明显的错误吗?
我必须遵循initComponent语法。我有一个边框布局,因为我的代码中有更多项目,但它们与此错误无关。感谢。
答案 0 :(得分:2)
您无法直接将html传递给items数组。您可以尝试这样做:
Ext.define("Ez.view.usefullinks.sitePanel", {
extend: "Ext.panel.Panel",
alias: "widget.usefullinkssitepanel",
region: "center",
layout: "fit",
listeners: {
afterrender: function() {
Ext.core.DomHelper.append(this.getEl(), '<iframe frameborder="0" src="http://www.google.com" width="100%" height="100%"></iframe>');
}
}
});
或
Ext.define("Ez.view.usefullinks.sitePanel", {
extend: "Ext.panel.Panel",
alias: "widget.usefullinkssitepanel",
region: "center",
layout: "fit",
html: '<iframe frameborder="0" src="http://www.google.com" width="100%" height="100%"></iframe>'
});