1.1.6 • Published 3 years ago

v-r-transition-plugin v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

安装

yarn add v-r-transition-plugin

使用

<template>
    <router-view v-slot='{ Component, route }'>
        <transition :name="route.meta.transition" :duration="350">
            <component :is='Component' />
        </transition>
    </router-view>
</template>

<script>
    import routeAnimation from 'v-r-transition-plugin'
    const app = createApp(App)
    app.use(router)
    app.use(routeAnimation)
</script>

transition与路由事件对应关系

事件transitionName
router.push'push'
router.go返回'pop'
$.present'present'
$.dismiss'dismiss'

注意

  • $.dismiss()使用后路由将直接回退到调用$.present()的地址
  • $.present()后,谨慎使用router.go(num < -1)

默认transition

.push-enter-active,
.push-leave-active,
.pop-enter-active,
.pop-leave-active,
.present-enter-active,
.present-leave-active,
.dismiss-enter-active,
.dismiss-leave-active {
    transition: transform 0.35s, opacity 0.35s;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.push-enter-active {
    transform: translateX(100vw);
}

.push-enter-to {
    transform: translateX(0);
}

.push-leave-to {
    transform: translateX(-35vw);
}

.pop-enter-active {
    transform: translateX(-100vw);
}
.pop-enter-to {
    transform: translateX(0);
}
.pop-leave-to {
    transform: translateX(35vw);
}

.present-enter-active {
    transform: translateY(100vh);
}
.present-enter-to {
    transform: translateY(0);
}

.dismiss-enter-active {
    opacity: 0;
}
.dismiss-enter-to {
    opacity: 1;
}
.dismiss-leave-active {
    transform: translateY(0);
}
.dismiss-leave-to {
    transform: translateY(100vh);
}
1.1.6

3 years ago

1.1.5

3 years ago

1.1.1

3 years ago

1.1.4

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago