Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title> velocity.js 库 </title>
  <script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.js"></script>
  <script src="https://cdn.bootcss.com/velocity/2.0.4/velocity.js"></script>
</head>
<body>
  <div id="app">
    <transition
        name="fade"
        @before-enter="handleBeforeEnter"
        @enter="handleEnter"
        @after-enter="handleAfterEnter"
    >
      <div v-show="show">
        hello world
      </div>
    </transition>
    <button @click="handleClick">切换</button>
  </div>
  <script>
    var vm = new Vue({
      el: "#app",
      data: {
        show: true
      },
      methods: {
        handleClick: function(){
          this.show = ! this.show
        },
        handleBeforeEnter: function(el){
          el.style.opacity = 0
        },
        handleEnter: function(el, done){
          Velocity(el, {opacity: 1}, {duration: 1000, complete: done})
        },
        handleAfterEnter: function(el){
          alert('动画结束')
        }
      }
    })
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
evenyaopro
0viewers