Thread.vue 622 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <li
  3. class="thread-list-item"
  4. :class="{ active: thread.id === currentThreadID }"
  5. @click="switchThread(thread.id)">
  6. <h5 class="thread-name">{{ thread.name }}</h5>
  7. <div class="thread-time">
  8. {{ thread.lastMessage.timestamp | time }}
  9. </div>
  10. <div class="thread-last-message">
  11. {{ thread.lastMessage.text }}
  12. </div>
  13. </li>
  14. </template>
  15. <script>
  16. import { switchThread } from '../vuex/actions'
  17. export default {
  18. props: ['thread'],
  19. vuex: {
  20. getters: {
  21. currentThreadID: state => state.currentThreadID
  22. },
  23. actions: {
  24. switchThread
  25. }
  26. }
  27. }
  28. </script>