• @keyframes动画和animate.css


     <style>
          @keyframes bounce-in {
            0%{
              transform: scale(0);
            }
            50%{
              transform: scale(1.5);
            }
            100%{
              transform: scale(1);
            }
          }
          .fade-enter-active{
            transform-origin: left center;
           animation: bounce-in 1s;
          }
          .fade-leave-active{
            transform-origin: left center;
            animation: bounce-in 1s reverse;
          }
      </style>
    </head>
    <body>
      <!-- 
        过程如下:
         显示  fade-enter,fade-enter-active      fade-enter-active,fade-enter-to     空
         隐藏  fade-leave,fade-leave-active      fade-leave-active,fade-leave-to     空
      -->
      <div id="root">
        <transition name='fade'>
          <h1 v-show='show'>
            最是年少时模样
          </h1>
        </transition>
        <button @click='change'>切换</button>
      </div>
      <script>
        var vm=new Vue({
          el:'#root',
          data:{
            show:true
          },
          methods:{
            change:function(){
              this.show=!this.show;
            }
          }
        })
      </script>
    </body>

    自定义类名:

    <style>
          @keyframes bounce-in {
            0%{
              transform: scale(0);
            }
            50%{
              transform: scale(1.5);
            }
            100%{
              transform: scale(1);
            }
          }
          .active{
            transform-origin: left center;
           animation: bounce-in 1s;
          }
          .leave{
            transform-origin: left center;
            animation: bounce-in 1s reverse;
          }
      </style>
    </head>
    <body>
      <!-- 
        过程如下:
         显示  fade-enter,fade-enter-active      fade-enter-active,fade-enter-to     空
         隐藏  fade-leave,fade-leave-active      fade-leave-active,fade-leave-to     空
      -->
      <div id="root">
        <transition name='fade' 
          enter-active-class='active'
          leave-active-class='leave'
        >
          <h1 v-show='show'>
            最是年少时模样
          </h1>
        </transition>
        <button @click='change'>切换</button>
      </div>
      <script>
        var vm=new Vue({
          el:'#root',
          data:{
            show:true
          },
          methods:{
            change:function(){
              this.show=!this.show;
            }
          }
        })
      </script>
    </body>

    animate.css使用:

      <script src="./node_modules/vue/dist/vue.js"></script>
      <link rel='stylesheet' type="text/css" href="./animate.css">
    </head>
    <body>
      <!-- 
        过程如下:
         显示  fade-enter,fade-enter-active      fade-enter-active,fade-enter-to     空
         隐藏  fade-leave,fade-leave-active      fade-leave-active,fade-leave-to     空
      -->
      <div id="root">
        <transition name='fade' 
          enter-active-class='animated tada'
          leave-active-class='animated rubberBand'
        >
          <h1 v-show='show'>
            最是年少时模样
          </h1>
        </transition>
        <button @click='change'>切换</button>
      </div>
      <script>
        var vm=new Vue({
          el:'#root',
          data:{
            show:true
          },
          methods:{
            change:function(){
              this.show=!this.show;
            }
          }
        })
      </script>
    </body>
  • 相关阅读:
    【caffe】epoch,[batch_size],iteration的含义
    OAuth2.0学习(1-6)授权方式3-密码模式(Resource Owner Password Credentials Grant)
    OAuth2.0学习(1-5)授权方式2-简化模式(implicit grant type)
    OAuth2.0学习(1-4)授权方式1-授权码模式(authorization code)
    OAuth2.0学习(1-3)OAuth2.0的参与者和流程
    OAuth2.0学习(1-1)OAuth2.0是什么?
    nodejs(1-1)
    HTTP协议扫盲(一)HTTP协议的基本概念和通讯原理
    MySql入门(2-2)创建数据库
    SpringCloud的注解:EnableEurekaClient vs EnableDiscoveryClient
  • 原文地址:https://www.cnblogs.com/em2464/p/12333032.html
Copyright © 2020-2023  润新知