我在每个视图中使用
au-animate
来实现页面过渡效果:当前视图向左滑出(从中心到左侧),下一个视图向左滑入(从右侧到中心)。@keyframes slideLeftIn {
0% {transform: translate(100%, 0);}
100% {transform: translate(0, 0);}
}
@keyframes slideLeftOut {
0% {transform: translate(0, 0);}
100% {transform: translate(-100%, 0);}
}
.pages.au-enter-active {
animation: slideLeftIn 0.8s;
}
.pages.au-leave-active {
animation: slideLeftOut 0.8s;
}
基于:Aurelia router view animation with swap-order="with"
现在,我需要在过渡期间在DOM中同时拥有两个视图,就像W3 slide一样。
在aurelia中是否有实现这一点的方法?
更新:
似乎有一个阻止此操作的错误: error aurelia-templating-router 1.0.1 with swap-order
更新2: 在最新版本中,已修复了此错误!Aurelia很棒。
swap-order="with"
时出现了问题。控制台记录了ERROR [app-router] TypeError: Cannot read property 'animatableElement' of undefined
的错误,并且当我更改路由器时它会不断添加视图。基本上没有动画。但是使用swap-order="before"
和swap-order="after"
可以正常工作,所以可能是个 bug。现在我正在使用swap-order="after"
进行类似的动画,但是您知道,视图之间存在间隙。 - isarswap-order="with"
对我来说运行良好。你在使用 TypeScript 吗? - Jeff Gau new --here
,1. Web(默认)
,1. Babel(默认)
,3. Sass
。此外,au -v
为0.23.0。 - isarswap-order="with"
我看到的是au-enter au-enter-active
,但没有与错误日志相关的au-leave au-leave-active
。所以它不断向 DOM 中添加视图。 - isarau-leave
和au-leave-active
类。但是,这些视图应该从DOM中移除。你确定这些视图仍然停留在DOM中吗? - Jeff Gswap-order="with"
的问题,正如你可以从我的更新问题中看到的那样。 - isar