nebula/components/common/topic/main.vue

48 lines
972 B
Vue
Raw Normal View History

2020-08-01 00:39:29 +08:00
<template>
2024-02-18 10:57:49 +08:00
<div class="wrapper">
<div style="background: white">
<el-menu type="border-card" :default-active="currentTopic"
style="width: 96%;margin: 0 auto" mode="horizontal"
2020-08-01 00:39:29 +08:00
@select="handleSelectTopic">
<el-menu-item index="news">最新</el-menu-item>
2024-02-18 10:57:49 +08:00
<el-menu-item v-for="topic in topicNavs" :key="topic.idTopic" :index="topic.topicUri">{{ topic.topicTitle }}
2020-08-01 00:39:29 +08:00
</el-menu-item>
</el-menu>
2024-02-18 10:57:49 +08:00
</div>
</div>
2020-08-01 00:39:29 +08:00
</template>
<script>
2024-02-18 10:57:49 +08:00
import {mapState} from 'vuex'
2020-08-01 00:39:29 +08:00
2024-02-18 10:57:49 +08:00
export default {
name: "topicNav",
props: {
currentTopic: {
type: String,
default: 'news'
}
},
computed: {
...mapState({
topicNavs: state => state.topic.data,
isFetching: state => state.topic.fetching
})
},
watch: {},
methods: {
handleSelectTopic(item) {
this.$router.push({
path: `/topic/${item}?page=1`
});
2020-08-01 00:39:29 +08:00
}
}
2024-02-18 10:57:49 +08:00
}
2020-08-01 00:39:29 +08:00
</script>
<style scoped>
</style>