0

私は dojo で bordercontainer の基本的な例を試しています。以下はその HTML コードですが、必要な出力が表示されません。ここで私が間違っていることを誰かに教えてもらえますか。このサンプル コードは、dojo チュートリアルからのみ取得したものであり、firebug でもエラーは発生しません。

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>ICN Layout</title>

</head>
<body>
  <!-- load Dojo -->
  <script>dojoConfig = {parseOnLoad: true}</script>
  <script src="dojo/dojo.js">
  </script>
  <script>
   require([
   "dijit/layout/BorderContainer", "dijit/layout/ContentPane",
   "dojo/domReady!"
   ], function(BorderContainer, ContentPane){
   // create a BorderContainer as the top widget in the hierarchy
   var bc = new BorderContainer({
    style: "height: 300px; width: 500px;"
   });

   // create a ContentPane as the left pane in the BorderContainer
   var cp1 = new ContentPane({
    region: "left",
    style: "width: 100px",
    content: "hello world"
   });
   bc.addChild(cp1);

   // create a ContentPane as the center pane in the BorderContainer
   var cp2 = new ContentPane({
    region: "center",
    content: "how are you?"
   });
   bc.addChild(cp2);

   // put the top level widget into the document, and then call startup()
   bc.placeAt(document.body);
   bc.startup();
   });
  </script>
</body>
</html>
4

2 に答える 2

0

必要なすべての dojo dijit dojox フォルダーを適切にダウンロードして配置しましたか? 次に、css をローカルに含めることができます。

<link rel="stylesheet" href="dijit/themes/claro/claro.css" media="screen">
<link rel="stylesheet" href="dojo/resources/dojo.css">

次のコードを追加すると、コードが問題なく動作することがわかりました。

    // create a ContentPane as the Top pane in the BorderContainer
    var cp0 = new ContentPane({
        region: "top",
        content: "This is The Top!"
    });
    bc.addChild(cp0);

cp0 ContentPane が問題なく上に配置されていることがわかります...領域を視覚化するために境界線 (およびおそらく背景色) を見たいと思いますか?

于 2015-06-10T04:39:28.947 に答える