zoukankan      html  css  js  c++  java
  • vue中的tab栏切换内容变换

    <!DOCTYPE html>
    <html lang="cn-zh">
    <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>
        <style>
             ul li {
                margin: 0;
                padding: 0;
                list-style: none;
            }
            #app {
                 600px;
                height: 400px;
                margin: 0 auto;
                border: 1px solid #ccc;
            }
            .tab-tilte{
                 90%;
            }
            .tab-tilte li{
                float: left;
                 50%;
                height: 44px;
                line-height: 44px;
                text-align: center;
                background-color:#fff;
                cursor: pointer;
            }
            /* 点击对应的标题添加对应的背景颜色 */
            .tab-tilte .active{
                background:url('./a.png') no-repeat;
                /* 地址是背景图标 */
                color: #fff;
                background-size: 100% 44px;
            }
            .tab-tilte .active1{
                background: url('./b.png') no-repeat;
                /* 背景图标 */
                color: #fff;
                background-size: 100% 44px ;
    
            }
            .tab-content div{
                float: left;
                 25%;
                line-height: 100px;
                text-align: center;
            }
        </style>
    </head>
    <body>
            <div id="app">
                <ul class="tab-tilte">
                    <li @click="cur=0" :class="{active:cur==0}">1.验证手机</li>
                    <li @click="cur=1" :class="{active1:cur==1}">2.企业认证</li>
                </ul>
                <div class="tab-content">
                    <div v-show="cur==0">内容一</div>
                    <div v-show="cur==1">内容二</div>
                </div>
            </div>  
        <script src="./vue.js"></script>
        <script>
            var app = new Vue({
                el: "#app",
                data: {
                    cur:0 //默认选中第一个tab
                },
            }); 
        
        
        </script>
    </body>
    </html>

     

    <!DOCTYPE html>
    <html lang="cn-zh">
    <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>
    <style>
    ul li {
    margin: 0;
    padding: 0;
    list-style: none;
    }
    #app {
    width: 600px;
    height: 400px;
    margin: 0 auto;
    border: 1px solid #ccc;
    }
    .tab-tilte{
    width: 90%;
    }
    .tab-tilte li{
    float: left;
    width: 50%;
    height: 44px;
    line-height: 44px;
    text-align: center;
    background-color:#fff;
    cursor: pointer;
    }
    /* 点击对应的标题添加对应的背景颜色 */
    .tab-tilte .active{
    background:url('./a.png') no-repeat;
    /* 地址是背景图标 */
    color: #fff;
    background-size: 100% 44px;
    }
    .tab-tilte .active1{
    background: url('./b.png') no-repeat;
    /* 背景图标 */
    color: #fff;
    background-size: 100% 44px ;

    }
    .tab-content div{
    float: left;
    width: 25%;
    line-height: 100px;
    text-align: center;
    }
    </style>
    </head>
    <body>
    <div id="app">
    <ul class="tab-tilte">
    <li @click="cur=0" :class="{active:cur==0}">1.验证手机</li>
    <li @click="cur=1" :class="{active1:cur==1}">2.企业认证</li>
    </ul>
    <div class="tab-content">
    <div v-show="cur==0">内容一</div>
    <div v-show="cur==1">内容二</div>
    </div>
    </div>
    <script src="./vue.js"></script>
    <script>
    var app = new Vue({
    el: "#app",
    data: {
    cur:0 //默认选中第一个tab
    },
    });
     
     
    </script>
    </body>
    </html>
  • 相关阅读:
    Android代码执行adb shell top命令读取结果
    Android8.0+跨应用发送广播和跨应用启动前台服务
    Android代码执行adb shell命令
    关于参数获取的那些事儿
    c# 如何处理自定义消息
    esp32 mqtt协议上报 dht11温湿度数据到onenet 指令下发控制开关灯
    swoole-simps自搭mqtt服务器,完美实现订阅,发布并存到mysql
    stm32f103c8t6+esp8266+dht11 mqtt上传温湿度到阿里云
    使用ST-Link下载程序出现Error:Flash Download Failed-“Cortex-M3“ 解决详细步骤(附图)
    stm32f407 oled iic例程,成功点亮oled屏
  • 原文地址:https://www.cnblogs.com/Alitar/p/10728626.html
Copyright © 2011-2022 走看看