使用流星的方式从一个模式打开另一个模式

Opening one modal from another using the meteor way

本文关键字:模式 一个 另一个 流星 方式      更新时间:2023-09-26

如何从另一个模式在流星打开一个模式?我使用的是bootstrap-3-modal package

当我尝试点击一个模态的confirm按钮时,它必须关闭该模态并打开一个新的模态。不知何故,它似乎不起作用。我有:

Template.addMoreTemplateConfirmationModal.events({
    'click #confirmMorePGInstance'(event){ // this is the confirm button on addMoreTemplateConfirmationModal modal 
        Modal.show('createTemplateModal'); // this does not work.
        // Modal.hide('addMoreTemplateConfirmationModal');
    }, 

您是否尝试在显示下一个之前关闭模态?

否则,您可能会在onDestroyed事件上触发第二个模态,尽管可能有更好的方法。

Template.addMoreTemplateConfirmationModal.onDestroyed(function() {
  Modal.show('createTemplateModal');
});

简单地使用setTimeout,它只在给定毫秒后运行一次(在下面的例子中为300毫秒)。

'click #confirmMorePGInstance': function(){
    // close modal here
    Meteor.setTimeout(function () {
        //open the next modal here
    }, 300);
},

PS:我建议使用50-100毫秒以上的关闭效果速度