<!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>
顶部tabbar标签选择
猜你喜欢
转载自blog.csdn.net/hql1024/article/details/103646574
今日推荐
周排行