效果图
直接上代码
1、html部分
<template>
<view>
<view class="tab-content">
<view class="tab-content1" @click="cur = 1" :class="{ active: cur == 1 }">
已处理
</view>
<view class="tab-content2" @click="cur = 2" :class="{ active: cur == 2 }">
待处理
</view>
</view>
<view class="tab">
<view v-show="cur == 1">
<view>已处理</view>
</view>
<view v-show="cur == 2">
<view>待处理</view>
</view>
</view>
</view>
</template>
2、js部分
<script>
export default {
data() {
return {
title: "",
cur: 1
}
},
methods: {
},
components: {
navbar
}
}
</script>
3、style样式部分
<style lang="scss">
.tab-content .active {
background-color: #3874eb !important;
color: #fff;
}
.tab-content {
display: flex;
}
.tab-content1 {
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
width: 50%;
height: 3rem;
border: 1px solid #ccc;
background-color: #fff;
}
.tab-content2 {
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
margin-top: 0px;
width: 50%;
height: 3rem;
border: 1px solid #ccc;
background-color: #fff;
}
</style>
如果报错把style标签的 lang="scss" 删了 或者下载个scss