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.
65 lines
1.2 KiB
65 lines
1.2 KiB
<template>
|
|
<div class="tabs">
|
|
<div
|
|
class="tab"
|
|
:class="value2 === item.value ? 'cur' : ''"
|
|
v-for="(item, index) in list"
|
|
@click="tabClick(index)"
|
|
:key="item.value"
|
|
>
|
|
{{ 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.value2);
|
|
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>
|
|
|