<style scoped>
.menu{
display: flex;
align-items: center;
}
.menu span{
color: #444950;
font-size: 12px;
line-height: 24px;
background: #f5f6f7;
padding: 0 6px;
display: block;
cursor: pointer;
}
.show{
color: #fff !important;
background: #1877f2 !important;
}
</style>
<div class="menu">
<span @click="btn(1)" :class="{show:tab === 1}">菜单一</span>
<span @click="btn(2)" :class="{show:tab === 2}">菜单二</span>
<span @click="btn(3)" :class="{show:tab === 3}">菜单三</span>
</div>
<div class="content">
<span v-if="tab == 1">内容一</span>
<span v-if="tab == 2">内容二</span>
<span v-if="tab == 3">内容三</span>
</div>
<script>
export default {
data () {
return {
tab: 1
}
},
methods: {
btn (key) {
this.tab = key
}
}
}
</script>