login.vue
<div :class="[ tab === item.tab ? 'tab_item active' : 'tab_item']" @click="tabName(item.tab)" v-for="item in items" :key="item.tab">
{{ item.tab }}
</div>
<script>
export default {
name: "login",
data() {
return {
tab:"密码登录" ,
items: [
{ tab: "密码登录"},
{ tab: "企业微信"},
{ tab: "钉钉登录"},
{ tab: "动态口令"},
{ tab: "统一身份认证"},
{ tab: "微信登录"}
],
};
},
methods:{
tabName:function(curTab){
this.tab = curTab;
}
}
};
</script>
<style lang="less" scoped>
.tab_item {
background: #eee;
padding: 6px 14px;
box-sizing: border-box;
border: 1px solid rgb(216, 208, 208);
border-top-left-radius: 8px;
border-top-right-radius: 8px;
cursor: pointer;
}
.tab_item:not(:first-child) {
border-left-style: none;
}
.tab_item.active {
border-bottom: none;
}
</style>