Context.ReturnFile 的 afterPostback 事件

afterPostback event with Context.ReturnFile

我发现当在 ViewModel 中使用 Context.ReturnFile() 时,afterPostback 事件没有被调用。我使用以下代码在发送回发时禁用页面上的所有按钮,并在 postback 完成后再次启用它们:

dotvvm.events.beforePostback.subscribe(function () {
    $('.btn-primary').prop('disabled', true).addClass('m-progress');
});
dotvvm.events.afterPostback.subscribe(function () {
    $('.btn-primary').removeAttr('disabled').removeClass('m-progress');
});

但是,当某些 ViewModel 使用 Context.ReturnFile() 来 return 生成的文件时,不会调用 afterPostback 并且页面上的所有按钮都保持禁用状态。

我也尝试过使用 spaNavigatingspaNavigated 事件,但它们似乎也没有被调用。

当文件从 ViewModel 编辑 return 时,是否有一些解决方法或调用的其他事件?

Context.ReturnFile 在内部使用重定向,重定向不会触发此事件。

我已提交 GitHub issue,我们将看看是否可以更改 afterPostback 事件的行为以在重定向时调用。如果没有,我们将针对这种情况推出一个新活动。