Vue實現顯示隱藏小功能-learn

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
            <title>
            </title>
            <style type="text/css">
                .slide-fade-enter-active {
   transition:all .3s ease;
  }
  .slide-fade-leave- {
   transition: all .8s cubic-bezier(1.0, 0.5, 0.8, 1.0);
  }
  .slide-fade-enter, .slide-fade-leave-active{
   transform: translateX(10px);
   opacity: 0;
  }
            </style>
        </meta>
    </head>
    <script src="https://unpkg.com/vue/dist/vue.js">
    </script>
    <body>
        <div id="example-1">
            <button @click="show=!show">
                Toggle render
            </button>
            <transition name="slide-fade">
                <p v-if="show">
                    hello
                </p>
            </transition>
        </div>
        <script type="text/javascript">
            new Vue({
  el:"#example-1",
  data:{
   show:true
  }
 })
        </script>
    </body>
</html>javascript

相關文章
相關標籤/搜索