zoukankan      html  css  js  c++  java
  • vue-transition

    <!Doctype>
    <html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport"
              content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
        <style>
            * {
                margin: 0;
                padding: 0;
            }
    
            .page-wrapper {
                position: relative;
            }
    
            .title {
                font-size: 22px;
                font-weight: 600;
                color: #333;
                text-align: center;
            }
    
            ul li {
                color: #333;
                padding: 6px 12px;
                height: 30px;
                line-height: 30px;
                border-bottom: 1px solid #ccc;
            }
    
            .style-a {
                font-size: 0;
            }
    
            .style-a a {
                font-size: 28px;
                display: inline-block;
                width: 50%;
                text-align: center;
                color: #666;
                text-decoration: none;
            }
    
            .style-a p {
                padding-left: 20px;
                font-size: 22px;
                height: 60px;
                line-height: 60px;
                text-align: left;
                color: #666;
            }
    
            .btn {
                padding-top: 20px;
                text-align: center;
            }
    
            button {
                padding: 12px 26px;
                display: inline-block;
                width: 120px;
                color: #fff;
                font-size: 16px;
                text-align: center;
                background: #0cc;
                border: none;
                border-radius: 6px;
                outline: none;
            }
    
            .img-area {
                width: 100%;
                padding: 20px 10px;
                text-align: center;
                box-sizing: border-box;
            }
    
            .img-area img {
                margin: 10px auto;
                width: 100%;
            }
    
            .img-area.fade-enter-active, .img-area.fade-leave-active {
                transition: all 2s ease;
            }
    
            .img-area.fade-enter, .img-area.fade-leave {
                opacity: 0
            }
    
            .expand-enter-active, .expand-leave-active {
                transition: all .8s ease;
                height: 630px;
                padding: 10px;
                color: #000000;
                background-color: #eee;
                overflow: hidden;
            }
    
            .expand-enter, .expand-leave {
                height: 0;
                padding: 0 10px;
                opacity: 0;
            }
        </style>
    </head>
    <body>
    <div id="app">
        <div class="page-wrapper">
            <div class="title">首页内容</div>
            <div class="style-a">
                <a href="javascript:;" @click="setTransitionName('fade')">fade</a>
                <a href="javascript:;" @click="setTransitionName('expand')">expand</a>
                <p>已经选择:{{transitionName}}</p>
            </div>
            <div class="btn">
                <button type="button" @click="show= !show">点击出现</button>
            </div>
            <transition :name="transitionName">
                <div class="img-area" v-show="show">
                    <img src="../img/bg.png">
                </div>
            </transition>
        </div>
    </div>
    <script src="../vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                show: false,
                transitionName: 'fade'
            },
            methods: {
                setTransitionName: function (name) {
                    this.transitionName = name;
                }
            }
        });
    </script>
    </body>
    </html>

    <!Doctype>
    <html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport"
              content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
        <style>
            * {
                margin: 0;
                padding: 0;
            }
    
            .page-wrapper {
                position: relative;
                height: 100%;
            }
    
            .title {
                font-size: 22px;
                font-weight: 600;
                color: #333;
                text-align: center;
            }
    
            ul li {
                color: #333;
                padding: 6px 12px;
                height: 30px;
                line-height: 30px;
                border-bottom: 1px solid #ccc;
            }
    
            .style-a {
                font-size: 0;
            }
    
            .style-a a {
                font-size: 28px;
                display: inline-block;
                width: 50%;
                text-align: center;
                color: #666;
                text-decoration: none;
            }
    
            .style-a p {
                padding-left: 20px;
                font-size: 22px;
                height: 60px;
                line-height: 60px;
                text-align: left;
                color: #666;
            }
    
            .btn {
                padding-top: 20px;
                text-align: center;
            }
    
            button {
                padding: 12px 26px;
                display: inline-block;
                width: 120px;
                color: #fff;
                font-size: 16px;
                text-align: center;
                background: #0cc;
                border: none;
                border-radius: 6px;
                outline: none;
            }
    
            .img-area {
                width: 100%;
                padding: 20px 10px;
                text-align: center;
                box-sizing: border-box;
                opacity: 1;
                transition: all 2s ease;
            }
    
            .img-area img {
                margin: 10px auto;
                width: 100%;
            }
    
    
        </style>
    </head>
    <body>
    <div id="app">
        <div class="page-wrapper">
            <div class="title">首页内容</div>
            <div class="btn">
                <button type="button" @click="toggleOpacity" >点击出现</button>
            </div>
            <transition :name="transitionName">
                <div class="img-area" :style="{opacity:opacityName}">
                    <img src="../img/bg.png">
                </div>
            </transition>
        </div>
    </div>
    <script src="../vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                opacityName: 0,
                transitionName: 'fade'
            },
            methods: {
                setTransitionName: function (name) {
                    this.transitionName = name;
                },
                toggleOpacity:function () {
                    if(this.opacityName){
                        this.opacityName= 0
                    }else{
                        this.opacityName= 1
                    }
                }
            },
            computed:{
    
            }
        });
    </script>
    </body>
    </html>
  • 相关阅读:
    MyCat分库分表-安装
    oracle 字符串格式转化 与 今天 /本周 /本月 查询
    java 接口开发时 后台无法获取前端传过来的参数值
    orace 异常 ORA-01830: 日期格式图片在转换整个输入字符串之前结束
    java json数据返回值中文乱码 出现???
    特殊的日子 2018年总结(一个人的胡言乱语)
    写在2016年的第365天,记录我的2016
    app mui框架 安卓手机app禁止截屏
    oracle 查询函数wm_concat,decode,COALESCE
    后台获取select的值,给页面添加默认值 【js】待续...
  • 原文地址:https://www.cnblogs.com/theWayToAce/p/7416523.html
Copyright © 2011-2022 走看看