transition 两个便签切换,同时在动解决

<!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script> <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.css" rel="stylesheet"> <link href="https://cdn.bootcss.com/animate.css/3.7.1/animate.css" rel="stylesheet"> <style> .div1 { width: 200px;height: 200px;background: red }
.move-enter { padding-left: 100px }
.move-enter-active { transition: all 2s }
.move-enter-to { padding-left: 0px }
.move-leave{ padding-left:0px } .move-leave-active{ transition: 2s all } .move-leave-to{ padding-left:100px }
  </style> </head>
<body> <div id="app"> <input type="button" name="" @click='change' value="按钮"> <transition name="move" mode="out-in"> <div v-if='flag' :key=1>显示</div> <div v-else :key=2>隐藏</div> </transition> </div>

<script> var vm = new Vue({ el: '#app', data: { flag: true }, methods: { change() { this.flag = !this.flag } }
}); </script>
</body>
</html>
上一篇:解决“fatal: 'origin' does not appear to be a git repository...”


下一篇:cinder-volume报错vmdk2 is reporting problems, not sending heartbeat. Service will appear "down&qu