DurandalJS-为什么用户导航时过渡不会立即开始 [英] DurandalJS - Why are transitions not starting right away when a user navigates

查看:61
本文介绍了DurandalJS-为什么用户导航时过渡不会立即开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释为什么当用户单击与Durandal的链接(导航)时过渡(至少是默认的-入口)没有立即开始吗?

Could someone explain why the transitions (at least the default one - entrance) are not starting right away when a user clicks on a link (navigate) with Durandal?

换句话说,我们是否需要两种机制(加载器动画+过渡)来指示正在进行的动作(例如,Activate方法内部的ajax调用)。

In other words, do we need two mechanisms (loader animation + transition) to indicate that there is an action underway (ex. ajax call inside the activate method).

我敢肯定有很好的理由,或者也许我只需要修改入口过渡?

I'm sure there's a good reason, or maybe I just have to modify the entrance transition?

推荐答案

似乎杜兰达尔的过渡激活功能解析后运行。我问了一个类似的问题,其中列举了一些我发现可行的解决方案针对我的具体情况:

It seems like Durandal's transitions run once the activate function resolves. I asked a similar question where I enumerated some of the possible solutions that I found which worked for my situation specifically:


  • 手动为其deactivate()中的每个视图设置动画,并通过其viewAttached()将其重新添加动画
  • >
  • .router.isNavigating绑定.page-host div的可见性(使用自定义绑定来处理过渡,例如来自剔除站点的fadeVisible示例)

  • 手动订阅router.isNavigating并在更改时运行自定义逻辑

  • Manually animate away every view in its deactivate() and animate it back in via its viewAttached()
  • Bind the .page-host div's visibility to router.isNavigating (using a custom binding to handle the transition such as the fadeVisible example from the knockout site)
  • Manually subscribe to router.isNavigating and run custom logic when it changes

希望这会有所帮助。

这篇关于DurandalJS-为什么用户导航时过渡不会立即开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆