美文网首页
2、在Vue中同时使用过渡和动画(Vue 中的动画特效)

2、在Vue中同时使用过渡和动画(Vue 中的动画特效)

作者: 秋玄语道 | 来源:发表于2018-06-30 09:08 被阅读0次
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>在Vue中同时使用过渡和动画</title>
        <script src="js/vue.js"></script>
        <link rel="stylesheet" href="css/demo.css">
        <link rel="stylesheet" href="css/animate.css">
        <style>
            .fades-enter,.fades-leave-to{
                opacity: 0;
            }
            .fades-enter-active,
            .fades-leave-active{
                transition: opacity 3s;
            }
        </style>
    </head>
    <body>
      <div id="app">
          <transition
    
                  :duration='{enter:5000,leave:10000}'
                  appear
                  name="fades"
                  enter-active-class="animated swing fades-enter-active"
                  leave-active-class="animated zoomInUp fades-leave-active"
                  appear-active-class="animated swing">
              <div v-if="seen">hello world</div>
          </transition>
          <button @click="handleClick">切换</button>
      </div>
      <script>
          new Vue({
              el:'#app',
              data:{
                  seen:true
              },
              methods:{
                  handleClick:function () {
                       this.seen=!this.seen
                  }
              }
          })
      </script>
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:2、在Vue中同时使用过渡和动画(Vue 中的动画特效)

          本文链接:https://www.haomeiwen.com/subject/ipxtuftx.html