我有一个backbone视图,它在打印按钮上有一个单击事件,如下所示:
var updateInvoice=Backbone.View.extend({
template:_.template(mytemplate),
events:{'click #print':'print'},
print:function()
{
window.frames['contentIframe'].print();
}
});现在的问题是,每当实例化上述视图时,都会自动调用print函数,而无需等待click事件发生。
发布于 2013-02-24 02:04:34
尝试将函数重命名为非标准名称,如下所示:
var updateInvoice=Backbone.View.extend({
template:._template(mytemplate),
events:{'click #print':'printInvoice'},
printInvoice:function()
{
window.frames['contentIframe'].print();
}
});https://stackoverflow.com/questions/15043590
复制相似问题