zoukankan      html  css  js  c++  java
  • vue切换选项卡能用版

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            #card{
                 500px;
                height: 350px;
            }
            .title{
                height:50px;
            }
            .title span{
                 100px;
                height: 50px;
                background-color:#666;
                display: inline-block;
                line-height: 50px; /* 设置行和当前元素的高度相等,就可以让文本内容上下居中 */
                text-align:center;
            }
            .content .list{
                 500px;
                height: 300px;
                background-color: palevioletred;
                display: none;
            }
            .content .active{
                display: block;
            }
    
            .title .current{
                background-color: palevioletred;
            }
        </style>
        <script src="js/vue.js"></script>
    </head>
    <body>
    
         <div id="card">
            <div class="title">
                <span @click="num=0" :class="num==0?'current':''">国内新闻</span>
                <span @click="num=1" :class="num==1?'current':''">国际新闻</span>
                <span @click="num=2" :class="num==2?'current':''">银河新闻</span>
            </div>
            <div class="content">
                <div class="list" :class="num==0?'active':''">国内新闻列表</div>
                <div class="list" :class="num==1?'active':''">国际新闻列表</div>
                <div class="list" :class="num==2?'active':''">银河新闻列表</div>
            </div>
        </div>
        <script脚本代码>
            var card = new Vue({
                el:"#card",
                data:{
                    num: 0,
                },
            });
         
        </script脚本代码>
    
    </body>
    </html>
    

      

  • 相关阅读:
    CF Round #427 (Div. 2) C. Star sky [dp]
    顺时针打印矩阵
    堆 栈-相关知识【转】
    二叉树的镜像
    树的子结构
    合并两个排序的链表
    数值的整数次方
    位运算:二进制中1的个数
    斐波那契数列及其变形
    重建二叉树
  • 原文地址:https://www.cnblogs.com/eliwen/p/12031418.html
Copyright © 2011-2022 走看看