You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<template>
|
|
|
|
<div class="tabs">
|
|
|
|
<div class="tab" :class="value2 === item.value?'cur':''" v-for="(item,index) in list" @click="tabClick(index)" :key="index">
|
|
|
|
{{item.label}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: "Tabs",
|
|
|
|
props: {
|
|
|
|
list:{
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
|
|
|
},
|
|
|
|
value:{
|
|
|
|
type: [String,Number],
|
|
|
|
default: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
value2: this.value,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.value2 = this.value
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
tabClick(index) {
|
|
|
|
this.value2 = this.list[index].value
|
|
|
|
this.$emit('changeVal',this.value)
|
|
|
|
this.$emit('changeLabel',this.list[index].label)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.tabs {
|
|
|
|
display: flex;
|
|
|
|
.tab {
|
|
|
|
cursor: pointer;
|
|
|
|
padding: 10px 11px;
|
|
|
|
font-size: 14px;
|
|
|
|
font-weight: 400;
|
|
|
|
color: #96B1CE;
|
|
|
|
min-width: 120px;
|
|
|
|
background: url("@/assets/images/manyidu/tab.png") repeat-x top left;
|
|
|
|
margin-right: 4px;
|
|
|
|
text-align: center;
|
|
|
|
&.cur {
|
|
|
|
color: #FFFFFF;
|
|
|
|
background: url("@/assets/images/manyidu/tab_cur.png") repeat-x top left;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|