html Tab 标签页应用

16 篇文章 0 订阅

(带内容显示层)

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <script src="https://cdn.suoluomei.com/common/js/jquery-2.1.4.min.js"></script>
    <script src="https://cdn.suoluomei.com/common/js2.0/vue/v2.5.16/vue.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>获奖详情</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .back {
            width: 100%;
            position: relative;
            height: 100%;
        }

        .back img {
            width: 100%;
            height: 100%;
        }

        .top {
            position: absolute;
            width: 100%;
            height: 5%;
            top: 16.7%;
        }

        .topbar {
            display: flex;
            flex-direction: row;
            width: 70%;
            height: 100%;
            margin-left: 10%;
            overflow: hidden;
            border-radius: 5px 5px 0 0;
        }

        .bechoice {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            background: #FCD844 !important;
            width: 25%;
            height: 100%;
        }

        .nochoice {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            background: #78CDB0;
            width: 25%;
            height: 100%;
            /* font-weight: bold; */
        }

        .xuan {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .xuan span {
            font-weight: 550;
            font-size: 0.7rem;
        }

        p {
            padding: 0;
            margin: 0;
        }

        .de {
            position: absolute;
            top: 22%;
            left: 10%;
            width: 80%;
            height: 60%;
            overflow-x: scroll;
            /* overflow-y:hidden; */
        }

        .inside {
            display: flex;
            flex-direction: column;
            margin: 0.5rem;
            padding: 0.5rem;
            border-bottom: 1px solid #4F947D;


        }

        .inside p {
            /* margin-bottom: 0.5rem; */
            font-size: 0.5rem;
            color: #4F947D;
        }

        .de::-webkit-scrollbar {
            display: none;
        }

        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>
    <div id="Vue">
        <div class="back">
            <img src="https://sucai.suoluomei.cn/sucai_zs/images/20191221160240-bj.png" alt="">
            <div class="top">
                <div class="topbar">
                    <div :class="[index == status ? 'bechoice':'nochoice']" v-for="(item,index) in list" :key="index">
                        <div class="xuan"><span @click="choicePrice(index,item.option,item.id)">{{item.option}}</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="de">
                <div class="inside" v-for="(item,index) in de" :key="index">
                    <p>{{item.title}}</p>
                    <p>{{item.text}}</p>
                    <p>兑奖码:{{item.code}}</p>
                    <p>过期时间:{{item.date}}</p>
                </div>
            </div>
        </div>



    </div>
</body>
<script>
    new Vue({
        el: "#Vue",
        data: {
            //数据
            status: 0,
            id: 1,
            list: [
                {
                    option: "待兑换",
                    id: 1
                },
                {
                    option: "已兑换",
                    id: 2
                },
                {
                    option: "已过期",
                    id: 3
                },
                {
                    option: "全部",
                    id: 4
                },
            ],
            de: [
                {
                    title: "禾葡兰SKINCASE+科学护肤体验店",
                    text: "特等奖:多效修护冻干粉体验装",
                    code: "15888888888",
                    date: "2020-1-6"
                },
                {
                    title: "禾葡兰SKINCASE+科学护肤体验店",
                    text: "特等奖:多效修护冻干粉体验装",
                    code: "15888888888",
                    date: "2020-1-6"
                },
                {
                    title: "禾葡兰SKINCASE+科学护肤体验店",
                    text: "特等奖:多效修护冻干粉体验装",
                    code: "15888888888",
                    date: "2020-1-6"
                },
                {
                    title: "禾葡兰SKINCASE+科学护肤体验店",
                    text: "特等奖:多效修护冻干粉体验装",
                    code: "15888888888",
                    date: "2020-1-6"
                },
                {
                    title: "禾葡兰SKINCASE+科学护肤体验店",
                    text: "特等奖:多效修护冻干粉体验装",
                    code: "15888888888",
                    date: "2020-1-6"
                }
            ]
        },
        methods: {
            //事件

            choicePrice(index, option, id) {
                let that = this
                that.status = index
                that.id = id
                console.log(that.id)
            }
        },
        created() {
            //加载事件
            if (status == 0) {
                console.log(this.id)
            }

        }
    })
</script>

</html>

核心代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <script src="https://cdn.suoluomei.com/common/js/jquery-2.1.4.min.js"></script>
    <script src="https://cdn.suoluomei.com/common/js2.0/vue/v2.5.16/vue.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>获奖详情</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .back {
            width: 100%;
        }

        .top {
            width: 100%;
        }

        .topbar {
            display: flex;
            flex-direction: row;
            width: 70%;
            height: 100%;
            margin-left: 10%;
            overflow: hidden;
            border-radius: 5px 5px 0 0;
        }

        .bechoice {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            background: #FCD844 !important;
            width: 25%;
            height: 100%;
        }

        .nochoice {
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            background: #78CDB0;
            width: 25%;
            height: 100%;
            /* font-weight: bold; */
        }

        .xuan span{
            font-weight: 550;
            font-size: 0.8rem;
        }

        p {
            padding: 0;
            margin: 0;
        }
    </style>
</head>

<body>
    <div id="Vue">
        <div class="back">
            <div class="top">
                <div class="topbar">
                    <div :class="[index == status ? 'bechoice':'nochoice']" v-for="(item,index) in list" :key="index">
                        <div class="xuan"><span @click="choicePrice(index,item.option,item.id)">{{item.option}}</span></div>
                    </div>
                </div>
            </div>
        </div>



    </div>
</body>
<script>
    new Vue({
        el: "#Vue",
        data: {
            //数据
            status: 0,
            id: 1,
            list: [
                {
                    option: "待兑换",
                    id: 1
                },
                {
                    option: "已兑换",
                    id: 2
                },
                {
                    option: "已过期",
                    id: 3
                },
                {
                    option: "全部",
                    id: 4
                },
            ],
        },
        methods: {
            //事件

            choicePrice(index, option, id) {
                let that = this
                that.status = index
                that.id = id
                console.log(that.id)
            }
        },
        created() {
            //加载事件
            if (status == 0) {
                console.log(this.id)
            }

        }
    })
</script>

</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值