Vue仿微信app页面跳转动画

2022-10-17,,,,

10:14:11独立开发者在开发移动端产品时,为了更高效,通常会使用web技术来开发移动端项目,可以同时适配android、ios、h5,稍加改动还可适配微信小程序。

在使用vue.js开发移动端页面的时候,默认的组件转场效果过于生硬,根本就没有动画效果。于是我用vue提供的组件过渡功能,写了个仿微信app页面跳转的动画,以提高用户体验。

废话不多说,直接上图

在600元骁龙632安卓测试机效果流畅。

代码量很少,已上传至github https://github.com/yellowdoing/vue-route-transition

核心代码

 

<transition :name="this.$store.routeaction">
<router-view/>
</transition>

 

css

.push-enter-active,.push-leave-active
, .pop-enter-active,.pop-leave-active{
transition: all 0.4s;
}

.push-leave-to{
transform: translate(-20%,0);
}

.push-enter {
transform: translate(100%, 0);
}
.push-enter-active {
z-index: 10;
}
.push-leave-active {
z-index: 0;
}
.pop-leave-active {
transform: translate(100%, 0);
z-index: 11;
}

.pop-enter{
transform: translate(-20%,0);
}

 

vue.js组件过渡相关文档  

 

 扫码关注微信公众号《it独立开发者》,帮助程序员拓展产品、运营、设计等思维能力,开发独立产品,致力成为自由职业者,实现财富自由。

您的点赞是我持续写作的动力

《Vue仿微信app页面跳转动画.doc》

下载本文的Word格式文档,以方便收藏与打印。