Vue仿微信app页面跳转动画效果

2022-10-16,,,,

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组件过渡相关文档

总结

以上所述是小编给大家介绍vue仿微信app页面跳转动画效果,希望对大家有所帮助

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

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