Files
ClassContent/历届学生/陈一航/项目/contact/zhbaohe/src/views/Home.vue
2024-09-27 02:06:13 +08:00

56 lines
1.2 KiB
Vue

<template lang="pug">
.home
van-tabs(v-model='active' @click="changeContent")
van-tab( v-for="(item,index) in TabsTitle" :key="index" :title='item.text')
div(:is="component")
</template>
<script>
// @ is an alias to /src
// import HelloWorld from '@/components/Lower.vue';
import Radio from '@/views/Radio.vue';
import Tv from '@/views/Tv.vue';
import Live from '@/views/Live.vue';
export default {
name: 'Home',
components: {
Radio,
Tv,
Live
},
data() {
return {
active: 0,
component: Radio,
TabsTitle: [
{ id: 0, text: '包河Radio', components: Radio },
{ id: 1, text: '包河TV', components: Tv },
{ id: 2, text: '融媒直播', components: Live },
]
}
},
created() {
this.active = parseInt(this.$route.query.id)
this.component = this.TabsTitle[this.active].components
},
methods: {
changeContent(index) {
this.active = index
this.$router.push({
path: '/',
query: {
id: index
}
})
this.component = this.TabsTitle[this.active].components
}
}
};
</script>
<style scoped lang="stylus">
@import "~@styl/home.styl"
</style>