0

过渡在惯性页面中不起作用。如果在过渡标签之间添加 appLayout。它的工作。但所有内容都提供过渡。

仪表板.vue

<template>
<admin-layout>
    <h1>Admin Dashboard</h1>
</admin-layout>
</template>

adminLayout.vue

<section class="adminPanel" :style="contentStyle">
    <AdminSvg/>
    <header-admin :style="headerStyle"/>
    <transition name="slide-fade">
        <div class="content">
            <slot></slot>
        </div>
    </transition>
    <sidebar-admin :style="sidebarStyle"/>
</section>

app.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>{{ config('app.name', 'Laravel') }}</title>
    <link rel="stylesheet" href="{{ asset('css/admin.css') }}">
    <script src="{{ asset('js/app.js') }}" defer></script>
</head>
<body>
    @inertia
</body>
</html>
4

1 回答 1

2

Vue 转换在转换标签包裹的元素发生变化(插入或移除)时起作用。由于惯性使用后端路由,因此模拟页面更改应该对此有所帮助。- 这不是最佳的,但它有效!

<section class="adminPanel" :style="contentStyle">
    <AdminSvg/>
    <header-admin :style="headerStyle"/>
    <transition name="slide-fade">
        <div v-if="content-trigger" class="content">
            <slot></slot>
          

        </div>
    </transition>
        <sidebar-admin :style="sidebarStyle"/>
</section>
<style>
    /* durations and timing functions.*/
    .slide-fade-enter-active {
        transition: all .5s ease;
    }
    .slide-fade-leave-active {
        transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
    }
    .slide-fade-enter, .slide-fade-leave-to
        /* .slide-fade-leave-active below version 2.1.8 */ {
        transform: translateX(10px);
        opacity: 0;
    }
</style>
<script>
    export default {
        data() {
            return {
                content-trigger:false
            }
        },
        mounted(){
            this.content-trigger = true;
        }
    }
</script>
于 2020-10-13T05:51:24.120 回答