-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCounterWidgetTemplate.html
30 lines (26 loc) · 1.11 KB
/
CounterWidgetTemplate.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<title>non-behavioral widget</title>
<link rel="stylesheet" href="https://localhost/arcgis_js_api/library/3.22/3.22compact/dijit/themes/tundra/tundra.css" />
<script src="https://localhost/arcgis_js_api/library/3.22/3.22compact/init.js">
</script>
<script type="text/javascript">
require(["dojo/_base/declare", "dijit/_Widget", "dijit/_TemplateMixin", "dojo/dom-construct"], function(declare, _Widget, _TemplateMixin, domConstruct) {
declare("Countor", [_Widget, _TemplateMixin], {
_i: 0,
templateString: "<div>" + "<button data-dojo-attach-event='onclick:increment'>增加计数</button>" + " 当前计数:<span data-dojo-attach-point='counter'>0</span>" + "</div>",
increment: function() {
this.counter.innerHTML = ++this._i;
}
});
});
require(["dojo/parser", "dojo/domReady!"], function(parser) {
parser.parse();
});
</script>
</head>
<body>
<span data-dojo-type="Counter"></span></body>
</html>