<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 显示或者离开的过渡效果 */
        .xiaotao-enter-active, .xiaotao-leave-active{
             transition: opacity 2s; /* 渐变  过渡 2秒 */
        }
        /* 显示前  或  隐藏后的效果 */
        .xiaotao-enter, .xiaotao-leave-to{
            opacity: 0; /* 都是隐藏效果 */
        }
                /* 显示或者离开的过渡效果 */
        .taozi-enter-active{
             transition: all 2s; /* 渐变  过渡 2秒 */
        }
        .taozi-leave-active{
             transition: all 5s; /* 渐变  过渡 2秒 */
        }
        /* 显示前  或  隐藏后的效果 */
        .taozi-enter, .taozi-leave-to{
            opacity: 0; /* 都是隐藏效果 */
            transform: translate(40px); /* 水平方向移动40像素*/
        }
    </style>
</head>
<body>
    <div >
        <!--首先通过click获取到show的值是true,然后加上一个!变成了false-->
        <!--然后show=false,从而v-show来进行隐藏-->
        <button @click="show = !show">渐变过渡</button>
        <transition name="xiaotao">
            <p v-show="show">xiaotaozi</p>
        </transition>
        
    </div>

    <div >
        <!--首先通过click获取到show的值是true,然后加上一个!变成了false-->
        <!--然后show=false,从而v-show来进行隐藏-->
        <button @click="show = !show">渐变过渡</button>
        <transition name="taozi">
            <p v-show="show">xiaotaozi</p>
        </transition>
        
    </div>
    <script src="../node_modules/vue/dist/vue.js"></Script>
    <script>
        new Vue({
            el: '#app',
            data: {
                show: true
            }
        })

        new Vue({
            el: '#app1',
            data: {
                show: true
            }
        })
    </script>
</body>
</html>
Vue---第二十五章渐进效果

 

 Vue---第二十五章渐进效果

 Vue---第二十五章渐进效果

 

 

相关文章:

  • 2022-03-04
  • 2021-07-04
  • 2021-10-10
  • 2022-01-19
  • 2021-12-05
  • 2021-11-03
  • 2022-12-23
猜你喜欢
  • 2021-09-24
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
相关资源
相似解决方案