0
我目前正在编写一个骨干应用程序,并已陷入似乎是一个非常简单的问题,但似乎无法解决。如何传递一个变量围绕视图与骨干
比方说,我有这样的(演示代码)视图
var View = Backbone.View.extend({
initialize: function() {
console.log('created a view');
},
events: {
'click button':'buttonClicked',
'click link':'linkClicked'
},
buttonClicked: function (event) {
// I would like to store the event and pass this to the
// linkClicked function below when the linkClicked function is called
var $currentEvent = $(event.currentTarget);
},
linkClicked: function() {
// When the link is clicked I would like to gain access to $currentEvent
}
});
我想通过单击链接时变量$ currentEvent的功能linkClicked。将模型存储在模型中还是可以将变量传递给视图最好?
任何帮助,这将是伟大的!
感谢
惊艳...感谢您的快速响应。没有意识到这很简单,但完全合理。再次感谢 – darylhedley