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>Vue中的列表过渡</title>
  <script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.js"></script>
  <style>
    .v-enter,
    .v-leave-to {
      opacity: 0;
    }
    .v-enter-active,
    .v-leave-active {
      transition: opacity 1s;
    }
  </style>
</head>
<body>
  <div id="app">
    <transition-group>
    <div v-for="item of list" :key="item.id">
      {{item.title}}
    </div>
    </transition-group>
    <button @click="handleBtnClick">Add</button>
  </div>
  <script>
    var count = 0
    var vm = new Vue({
      el: "#app",
      data: {
        list: []
      },
      methods: {
        handleBtnClick: function(){
          this.list.push({
            id: count++,
            title: 'hello world'
          })
        }
      }
    })
  </script>
</body>
</html>
Output 300px

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

Dismiss x
public
Bin info
evenyaopro
0viewers