vue 请求一个 json 怎么把数据分开显示在tab切换中
<template>
<section class="wh-section wh-forum">
<TabGroup>
<li v-on:click="tab(index)">
<span>待办</span>
<em>{{ loadToReadNum() }}</em>
</li>
<li v-on:click="tab(index)">
<span>待阅</span>
<em>{{ loadToDoNum() }}</em>
</li>
</TabGroup>
<Search />
<ul class="listitem">
<li v-for="(item, index) in forumlist.items" >
<div>
<p>{{ item.title }}</p>
<p><span>{{ item.times }}</span><em>{{ item.status }}</em><em>{{ item.em }}</em></p>
</div>
</li>
</ul>
</section>
</template>
<script>
import {
GET_FORUM_TODO
} from '@/scripts/constant';
import Search from "@/components/Search";
import TabGroup from "@/components/TabGroup";
import { mapState } from 'vuex';
export default{
computed: {
...mapState(['forumlist'])
},
created () {
this.$store.dispatch(GET_FORUM_TODO);
},
methods: {
loadToReadNum: function () {
return this.$store.getters.toRead.length;
},
loadToDoNum: function () {
return this.$store.getters.toDo.length;
},
tab: function (index) {
this.selected = index;
}
},
components: { Search, TabGroup }
};
</script>