2 sonaxh sonaXH 于 2017.09.06 10:02 提问

webpack+ vue tab数据传输问题 1C

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>

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.06 23:48
Csdn user default icon
上传中...
上传图片
插入图片