我想在此链接的主干视图中接收属性。我不确定这是在 Backbone 中执行此操作的正确方法。也许这个链接的参数应该在视图渲染上设置?
<a class="postDeleteLink" data-id="5" data-hash="Hgsda45f">Delete</a>
我绑定事件的主干代码:
PostListView = Backbone.View.extend({
events: {
"click .postDeleteLink": "deletePost"
},
deletePost: function(){
//standart jquery way doesn't work, because "this" is already used by backbone
var id = $(this).attr('data-id');
var hash = $(this).attr('data-hash');
}