2

嗨,我有一个简单的,如下所示,它显示了边框容器和内容窗格。我不明白为什么边界容器的 id 注册了两次,因为我只为边界容器定义了一个 id。

错误说明:错误:尝试使用 id==main_bContainer 注册小部件,但该 id 已注册请告知我哪里弄错了。

<!DOCTYPE html>
<html>
<head>
<title>Hello</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../dojo1_8/dijit/themes/soria/soria.css"/>
<link rel="stylesheet" href="../common.css"/>
<style type="text/css">
html, body 
{
    width: 100%;
    height: 100%;
    margin: 5px;
    padding: 0px;
    overflow: hidden;
}

</style>



</head>

<body class="soria">
<div id="main_bContainer" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'sidebar'">
    <div class="cP_Left" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
        Content Pane A
    </div>
    <div class="cP_Right" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'">
        Content Pane B
    </div>

</div>
</body>

<script>            
var dojoConfig =
            {
                parseOnLoad: true,//replace web controls based on theme soria
                isDebug: true,//true for debuggin with aid  from FireBug, Always set it to false, to avoid overhead
                async: true,//
                locale : "en-us"//
            }; 
</script>

<script src='../dojo1_8/dojo/dojo.js'></script>

<script>require(["dojo/parser",
             "dojo/ready",
             "dojo/request",
             "dijit/layout/BorderContainer",
             "dijit/layout/ContentPane",
             "dojo/domReady!"
            ], function(parser, ready, request)
            {ready(function()
                {parser.parse();




            });
    });
</script>
</html>

谢谢克莱门特

4

1 回答 1

4

因为你有parse()它的2次。

这里dojoConfig = { parseOnLoad: true };

和这里parser.parse();

只有parse一个问题会解决。

于 2013-01-25T06:01:33.620 回答