ThreadSection.vue 716 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <div class="thread-section">
  3. <div class="thread-count">
  4. <span v-show="unreadCount">
  5. Unread threads: {{ unreadCount }}
  6. </span>
  7. </div>
  8. <ul class="thread-list">
  9. <thread
  10. v-for="thread in threads"
  11. :key="thread.id"
  12. :thread="thread"
  13. :active="thread.id === currentThread.id"
  14. @switch-thread="switchThread">
  15. </thread>
  16. </ul>
  17. </div>
  18. </template>
  19. <script>
  20. import Thread from './Thread.vue'
  21. import { mapActions, mapGetters } from 'vuex'
  22. export default {
  23. name: 'ThreadSection',
  24. components: { Thread },
  25. computed: mapGetters(['threads', 'currentThread', 'unreadCount']),
  26. methods: mapActions(['switchThread'])
  27. }
  28. </script>