2

我的最终游戏是将上传者添加到对话框中。那行不通,所以我走了简单的路线,看看它是否可行。下面是我可以做到的尽可能简单,遗憾的是,单击按钮时文件选择器不显示。我在 Firefox 和 Chrome 中工作。如果有人愿意仔细检查并找到一个傻瓜,我将不胜感激。

require(["dojox/form/Uploader",
    "dojo/dom",
    "dojox/form/uploader/plugins/IFrame",
    "dojo/domReady!"
  ],
  function(Uploader, dom) {
    var u = new Uploader({
      name: "myPhoto",
      label: "Upload Your Photo",
      multiple: false,
      uploadOnSelect: true,
      url: "to/the/ethreal"
    });
    dom.byId("myDiv").appendChild(u.domNode);
  });
<html>

<head>
  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dijit/themes/claro/claro.css" media="screen">
  <!-- load dojo and provide config via data attribute -->
  <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js" data-dojo-config="async: true"></script>
</head>

<body class="claro">
  <div id="myDiv"></div>
</body>

</html>

4

1 回答 1

4

好吧,我认为它最终会变得很愚蠢,但是需要启动小部件。经过半天的时间,我希望道场示例不会遗漏这些关键方面。

操作函数如下所示:

require(["dojox/form/Uploader",
    "dojo/dom",
    "dojox/form/uploader/plugins/IFrame",
    "dojo/domReady!"
  ],
  function(Uploader, dom) {
    var u = new Uploader({
      name: "myPhoto",
      label: "Upload Your Photo",
      multiple: false,
      uploadOnSelect: true,
      url: "to/the/ethreal"
    }, "myDiv");
    u.startup();
  });
<head>
  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dijit/themes/claro/claro.css" media="screen">
  <!-- load dojo and provide config via data attribute -->
  <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js" data-dojo-config="async: true"></script>
</head>

<body class="claro">
  <div id="myDiv"></div>
</body>

正如我确信已经多次声明的那样,获取信息的最佳地点是Nightly Build的测试。我在FileUpload上找到了丢失的块。

于 2012-04-18T21:01:34.657 回答