index.html 900 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
  6. <script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
  7. <style>
  8. /* 可以设置不同的进入和离开动画 */
  9. /* 设置持续时间和动画函数 */
  10. .fade-enter-active, .fade-leave-active {
  11. transition: opacity 2s
  12. }
  13. .fade-enter, .fade-leave-to /* .fade-leave-active, 2.1.8 版本以下 */ {
  14. opacity: 0
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <div id = "databinding">
  20. <button v-on:click = "show = !show">点我</button>
  21. <transition name = "fade">
  22. <p v-show = "show" v-bind:style = "styleobj">动画实例</p>
  23. </transition>
  24. </div>
  25. <script type = "text/javascript">
  26. var vm = new Vue({
  27. el: '#databinding',
  28. data: {
  29. show:true,
  30. styleobj :{
  31. fontSize:'30px',
  32. color:'red'
  33. }
  34. },
  35. methods : {
  36. }
  37. });
  38. </script>
  39. </body>
  40. </html>