1.

 1 define(["dojo/_base/declare",
 2         "dijit/form/Button"],function(declare,Button){
 3     return declare("mynamespace.Button",Button,{
 4         label:"My Button",
 5         onClick:function(evt){
 6             alert("I was clicked");
 7             this.inherited(arguments);
 8         }
 9     });
10 });

 

2.

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 2 <html>
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 5 <title>Tutorial: Hello Dojo!</title>
 6 </head>
 7 <body>
 8     <h1 id="greeting">Hello</h1>
 9     <script src="dojo/dojo/dojo.js"    data-dojo-config="async: true"></script>
10     <script type="text/javascript">
11         require(['myclass/button'],function(myclass){
12             var m = new myclass();
13             alert(m.label);
14             alert(m.onClick());
15         });
16     </script>
17 </body>
18 </html>

 

 

3.

 

posted on 2016-12-30 14:45  Sharpest  阅读(162)  评论(0编辑  收藏  举报