zoukankan      html  css  js  c++  java
  • vue过场动画

    <template>
      <div id="app">
        <transition :enter-active-class="enterTransition" :leave-active-class="leaveTransition">
          <keep-alive>
            <router-view class="routeView" />
          </keep-alive>
        </transition>
      </div>
    </template>
    
    <script>
    import myhea from "@/components/hea.vue";
    import myfooter from "@/components/footer.vue";
    export default {
      name: "App",
      components: {
        myhea,
        myfooter,
      },
      data() {
        return {
          enterTransition: "animate__animated animate__fadeIn",
          leaveTransition: "animate__animated animate__fadeOut",
        };
      },
      watch: {
        $route(to, from) {
          let toDepth = to.meta.depth;
          let fromDepth = from.meta.depth;
          if (fromDepth > toDepth) {
            this.enterTransition = "animate__animated animate__fadeInLeft";
            this.leaveTransition = "animate__animated animate__fadeOutRight";
          } else if (fromDepth < toDepth) {
            this.enterTransition = "animate__animated animate__fadeInRight";
            this.leaveTransition = "animate__animated animate__fadeOutLeft";
          } else {
            this.enterTransition = "animate__animated animate__fadeIn";
            this.leaveTransition = "animate__animated animate__fadeOut";
          }
        },
      },
    };
    </script>
    
    <style>
    .routeView {
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
    }
    * {
      margin: 0px;
      padding: 0px;
    }
    #app {
      min- 20rem;
      font-family: Avenir, Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-align: center;
      color: #2c3e50;
    }
    </style>
    $ npm install animate.css --save
    

      

    代码改变了我们,也改变了世界
  • 相关阅读:
    安装篇-安装Nacos
    安装篇-安装RabbitMQ
    C类型字符串和字符数组的区别
    数据结构之链表操作
    Android WebView学习
    MySQL初级学习
    Android LinearLayout深入学习
    排序算法总结
    Apache Mina-1
    Nginx+Keepalived 集群方案
  • 原文地址:https://www.cnblogs.com/wencaiguagua/p/13716995.html
Copyright © 2011-2022 走看看