【问题标题】:I can't add Vue page transition with inertia js in vue js我无法在 vue js 中添加带有惯性 js 的 Vue 页面过渡
【发布时间】:2021-01-07 13:28:22
【问题描述】:

过渡不适用于惯性页面。如果在过渡标签之间添加 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>

【问题讨论】:

    标签: laravel vue.js vuejs3 laravel-8 inertiajs


    【解决方案1】:

    当被转换标签包裹的元素改变(插入或移除)时,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>
    

    【讨论】:

    • 工作!...只是提到“content-trigger”不是有效值(contentTrigger或其他东西......)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-13
    • 2022-11-11
    • 2020-10-04
    • 2021-03-09
    • 2021-06-25
    • 2016-06-28
    相关资源
    最近更新 更多