学习道场并且可能会忽略某些事情。
让TabContainer工作,但是当单击选项卡时,想要使用不在同一服务器上的外部文件加载TabContainer。就像iframe的工作方式一样。无论如何使用dojo执行此操作?
谢谢! 贝
答案 0 :(得分:0)
设置ContentPane
require([
"dijit/layout/TabContainer"
, "dijit/layout/ContentPane"
, "dojo/domReady!"
], function(
TabContainer
, ContentPane
){
var tc = new TabContainer({
style: "height: 100%; width: 100%;"
}, "tc1-prog");
var cp1 = new ContentPane({
title: "Greeting"
, href: "/gh/gist/response.html/8372613/"
});
tc.addChild(cp1);
tc.startup();
});
如果不支持CORS,您可以使用dojo/dom-construct
require([
"dijit/layout/TabContainer"
, "dijit/layout/ContentPane"
, "dojo/dom-construct"
, "dojo/domReady!"
], function(
TabContainer
, ContentPane
, domConstruct
){
var tc = new TabContainer({
style: "height: 100%; width: 100%;"
}, "tc1-prog");
var cp1 = new ContentPane({
title: "CORS"
, content: domConstruct.create("iframe", {
"src": "http://en.wikipedia.org/wiki/Cross-origin_resource_sharing"
, "style": "border: 0; width: 100%; height: 100%"
})
});
tc.addChild(cp1);
tc.startup();
});