繁体   English   中英

Zurb Foundation Reveal(Modal)关闭后事件未触发吗?

[英]Events not firing after Zurb Foundation Reveal (Modal) closes?

我正在Zurb Foundation Reveal(模式)部分中打开Backbone视图。

this.$('#ChangeIconModal').html( this.editIconView.render().el );

第一次工作正常。 但是,如果我关闭它(通过单击它,或者通过调用$('#ChangeIconModal').foundation('reveal', 'close') ),则我设置的click事件不再触发。

这是我设置点击事件的方式:

events: { 'click button.finish': 'finish', 'click a.close-reveal-modal': 'close' }

而且,无论关闭如何发生,完成后我都会删除Backbone视图:

this.remove();

我所做的事情似乎有明显的错误吗?

PS-我是整个Backbone / Zurb世界的新手,所以请多多包涵。 如果您需要更多信息,我会很乐意提供,只是不知道提供什么。

啊,我知道了。 这是我的工作,以防其他人遇到相同的问题。

这是我以前的看法:

initialize: function() {
    // Other initialize code here...
    this.editIconView = new IconEditView({ model: this.model });
}

iconEdit: function() {
    this.$('#SubtabEditModal').html( this.editIconView.render().el );
}

但是,由于稍后我调用了remove ,因此对editIconView的引用不再有效。

我不得不更改代码,使其更像这样:

initialize: function() {
    // Other initialize code here...
}

iconEdit: function() {
    this.editIconView = new IconEditView({ model: this.model });
    this.$('#SubtabEditModal').html( this.editIconView.render().el );
}

它现在似乎正在工作。 如果不清楚,请发表评论,我会尽力提供帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM