Dojo Dijit程序手风琴

时间:2014-05-21 15:35:57

标签: dojo

尝试动态布局中的动态手风琴菜单。在顶级容器上运行startup(),IIRC是按照文档进行的,手风琴不会初始化,只显示第一个窗格。没有在顶级容器上运行启动初始化手风琴(虽然看起来很不好),但没有初始化布局。删除所有动态代码以演示问题。谢谢你的任何想法。

<!DOCTYPE html>
<html >
<head>

    <link rel="stylesheet" href="css/style4.css" media="screen">
    <script>dojoConfig = {parseOnLoad: true}</script>
    <script src="dojo.1.9.3/dojo/dojo.js"> </script>

    <script>
require([
    "dijit/layout/BorderContainer",
    "dijit/layout/ContentPane",
    "dijit/layout/TabContainer",
    "dijit/layout/AccordionContainer", 
    "dijit/layout/AccordionPane",
    "dojo/domReady!"
], function(BorderContainer, ContentPane, TabContainer, AccordionContainer, AccordionPane){

    var bc = new BorderContainer({style: "height: 600px; width: 800px;"});

    var cp1 = new ContentPane({
        region: "left",
        style: "height: 400px",
        content: "hello world"
    });
    bc.addChild(cp1);
    var cp2 = new ContentPane({
        region: "center",
        style: "height: 400px",
    });
    var aContainer = new AccordionContainer();
    aContainer.addChild(new AccordionPane({
        title: "number one",
        content: "Hello world"
    }));
    aContainer.addChild(new AccordionPane({
        title: "number two",
        content: "Hello Goodbye"
    }));
    cp2.addChild(aContainer);
    bc.addChild(cp2);
    document.body.appendChild(bc.domNode);
    bc.startup();
    //cp2.startup();
});
    </script>
</head>
<body class="claro">

</body>
</html>

1 个答案:

答案 0 :(得分:1)

这看起来像是一个简单的拼写错误,没有名为dijit/layout/AccordionPane的模块。要使用AccordionContainer,您也可以使用ContentPane,如参考指南中的examples所示。例如:

var aContainer = new AccordionContainer();
aContainer.addChild(new ContentPane({
    title: "number one",
    content: "Hello world"
}));
aContainer.addChild(new ContentPane({
    title: "number two",
    content: "Hello Goodbye"
}));

简单地用AccordionPane替换ContentPane&#39}似乎工作正常,正如您在此JSFiddle中所看到的那样:http://jsfiddle.net/34NN6/