-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
/
Copy pathThreadSection.vue
39 lines (36 loc) · 935 Bytes
/
ThreadSection.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<template>
<div class="thread-section">
<div class="thread-count">
<span v-show="unreadCount">
Unread threads: {{ unreadCount }}
</span>
</div>
<ul class="thread-list">
<thread
v-for="thread in threads"
:key="thread.id"
:thread="thread"
:active="thread.id === currentThread.id"
@switch-thread="switchThread">
</thread>
</ul>
</div>
</template>
<script>
import { computed } from 'vue'
import { useStore } from 'vuex'
import Thread from './Thread.vue'
export default {
name: 'ThreadSection',
components: { Thread },
setup () {
const store = useStore()
return {
threads: computed(() => store.getters.threads),
currentThread: computed(() => store.getters.currentThread),
unreadCount: computed(() => store.getters.unreadCount),
switchThread: (id) => store.dispatch('switchThread', id)
}
}
}
</script>