Skip to content

Commit 8a926ec

Browse files
committed
add page transition
1 parent c71754b commit 8a926ec

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

stubs/resources/js/Layouts/AuthenticatedLayout.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@
2828
@sidebar:toggle="sidebarToggle"
2929
/>
3030
<div class="mx-8 2xl:mx-16">
31-
<slot></slot>
31+
<transition name="fade" mode="out-in">
32+
<div :key="$page.url">
33+
<slot></slot>
34+
</div>
35+
</transition>
3236
</div>
3337
</main>
3438
</template>
3539

3640
<script setup>
37-
import { ref, onMounted, computed } from 'vue'
41+
import { ref, onMounted } from 'vue'
3842
import { Head } from '@inertiajs/vue3'
3943
import useIsMobile from '@/Composables/useIsMobile'
4044
import menu from '@/Configs/menu'
@@ -57,3 +61,14 @@ const sidebarToggle = () => {
5761
5862
const items = menu.items
5963
</script>
64+
65+
<style scoped>
66+
.fade-enter-active,
67+
.fade-leave-active {
68+
@apply transition-opacity duration-300 ease-out;
69+
}
70+
.fade-enter-from,
71+
.fade-leave-to {
72+
@apply opacity-0;
73+
}
74+
</style>

0 commit comments

Comments
 (0)