This commit is contained in:
yiqiuyang
2025-09-10 00:21:39 +08:00
parent 17180ec339
commit cc70e75a93
2 changed files with 16 additions and 2 deletions

View File

@ -6,6 +6,7 @@
:class="{ active: activeIndex === item.id }" :class="{ active: activeIndex === item.id }"
v-for="item in tabList" v-for="item in tabList"
:key="item.id" :key="item.id"
@click="setActiveIndex(item.id)"
> >
{{ item.label }} {{ item.label }}
</div> </div>
@ -26,7 +27,14 @@ export default {
}; };
}, },
mounted() {}, mounted() {},
methods: {}, methods: {
setActiveIndex(id) {
if (this.activeIndex !== id) {
this.activeIndex = id;
this.$bus.emit("setActiveIndex", this.activeIndex);
}
},
},
}; };
</script> </script>

View File

@ -15,7 +15,13 @@ export default {
return {}; return {};
}, },
mounted() {}, mounted() {},
methods: {}, methods: {
receiveBUS() {
this.$bus.on("setActiveIndex", (val) => {
console.log("val===>", val);
});
},
},
}; };
</script> </script>