Dojo TabContainer示例不起作用

时间:2016-08-12 16:05:48

标签: javascript dojo

我一直试图从https://dojotoolkit.org/reference-guide/1.10/dijit/layout/TabContainer.html运行示例,但我没有得到任何标签。这是我的代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
</head>
<body>
    <link rel="stylesheet"
    href="http://ajax.googleapis.com/ajax/libs/dojo/1.11.2/dijit/themes/claro/claro.css" />
    <!-- load Dojo -->
    <script src="//ajax.googleapis.com/ajax/libs/dojo/1.11.2/dojo/dojo.js"></script>

    <div style="width: 350px; height: 290px">
        <div id="tc1-prog"></div>
    </div>

    <script>
        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 : "Food",
                content : "We offer amazing food"
            });
            tc.addChild(cp1);

            var cp2 = new ContentPane({
                title : "Drinks",
                content : "We are known for our drinks."
            });
            tc.addChild(cp2);

            tc.startup();
        });
    </script>

</body>

</html>

我在这里遗漏了什么吗?感谢

1 个答案:

答案 0 :(得分:0)

你只需要在body标签中添加class =“claro”。之前已经回答过:Dojo TabContainer not styling