@qzdata/vue-petite-transition
v2.0.5
Published
A simple solution for transition for petite-vue .
Downloads
3
Maintainers
Readme
Petite Vue Transition
Petite Transition Library for Petite Vue
Getting Started
Installation
npm install vue-petite-transition@latest
pnpm i vue-petite-transition
yarn add vue-petite-transition
Configuration
Then, in your html script where you defined your petite-vue instance
<script type="module">
import { createApp } from 'petite-vue'
// import vue-petite-transition from npm
import { transitionDirective } from 'vue-petite-transition'
// or via unpkg
import { transitionDirective } from "https://unpkg.com/vue-petite-transition?module";
// or direct cdn for production (to avoid redirect cost)
import { transitionDirective } from "https://unpkg.com/[email protected]/dist/vue-petite-transition.es.js";
// register the directive
createApp().directive('transition',transitionDirective).mount()
</script>
CDN URLs
ESM build:
https://unpkg.com/[email protected]/dist/vue-petite-transition.es.js
The short CDN URL is meant for prototyping. For production usage, use a fully resolved CDN URL to avoid resolving and redirect cost:
provided API for v-transition
v-transition:show
- type: boolean
- Whether the children should be shown or hidden
v-transition:enter
- type: string
- Classes added to the element during the entire enter phase.
- e.g. v-transition:enter="duration-1000"
v-transition:enter-from
- type: string
- Classes added to the element before the enter phase starts.
- e.g. v-transition:enter-from="opacity-0"
v-transition:enter-to
- type: string
- Classes added to the element immediately after the enter phase starts.
- e.g. v-transition:enter-to="opacity-100"
v-transition:entered
- type: string
- Classes added to the element once the transition is done. These classes will persist after that, until it's time to leave.
- e.g. v-transition:entered="opacity-100"
v-transition:leave
- type: string
- Classes added to the element during the entire leave phase.
- e.g. v-transition:leave="duration-1000 ease-out"
v-transition:leave-from
- type: string
- Classes added to the element before the leave phase starts.
- e.g. v-transition:leave-from="opacity-100"
v-transition:leave-to
- type: string
- Classes added to the element immediately after the leave phase starts.
- e.g. v-transition:leave-to="opacity-0"
Example
** Just Passing enter enter-from enter-to values works **
<div v-scope="{ show:true }" class="h-96 w-96">
<p>show: {{ show }}</p>
<button @click="show = !show" class="px-2 bg-slate-900 text-white py-0.5 flex items-center justify-center" > toggle </button>
<div v-transition:show="!show"
class="p-10 bg-sky-400 opacity-0 scale-90"
v-transition:enter="duration-1000 transition-[opacity,transform]"
v-transition:enter-from="opacity-0 scale-90"
v-transition:enter-to="opacity-100 scale-100"
> Show {{!show}}
</div>
</div>
Acknowledgement
Thanks, Now Have Fun Bye Bye !