我编写了这个非常简单的 Ember 代码,但由于某种原因,当我按下按钮时,事件似乎没有触发。有小费吗?
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<script type="text/x-handlebars">
{{#view CounterView}}
Counter: {{Counter.value}}
<button {{action "increment"}}>Add 1</button>
{{/view}}
</script>
<script src="jquery-1.7.2.min.js"></script>
<script src="handlebars-1.0.rc.1.min.js"></script>
<script src="ember-1.0.pre.min.js"></script>
<script>
Counter = Ember.Object.create({
value: 1,
})
CounterView = Ember.View.extend({
increment: function(event) {
Counter.incrementProperty('value');
}
})
</script>
</body>
</html>