diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/Home.vue | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/src/views/Home.vue b/src/views/Home.vue index 1fbbb7f..7bd99a2 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue | |||
| @@ -1,16 +1,23 @@ | |||
| 1 | <template> | 1 | <template> |
| 2 | <div class="home" v-hotkey="keymap"> | 2 | <div class="home" v-hotkey="keymap"> |
| 3 | Hi {{get_username}}! | 3 | Hi {{get_username}}! |
| 4 | <Searcher | 4 | |
| 5 | v-if="popups.searcher_show" | 5 | <div v-for="group in groups" :key="group.name" > |
| 6 | @close="hideSearcher" | 6 | <GroupSender |
| 7 | @toogle_group_maker="toogleGroupShow" | 7 | :group="group" |
| 8 | /> | 8 | /> |
| 9 | </div> | ||
| 9 | 10 | ||
| 10 | <GroupMaker | 11 | <GroupMaker |
| 11 | v-if="popups.group_maker_show" | 12 | v-if="popups.group_maker_show" |
| 12 | @close="hideGroup" | 13 | @close="hideGroup" |
| 14 | /> | ||
| 13 | 15 | ||
| 16 | <Searcher | ||
| 17 | v-if="popups.searcher_show" | ||
| 18 | @close="hideSearcher" | ||
| 19 | @toogle_group_maker="toogleGroupShow" | ||
| 20 | @group_set="openGroup" | ||
| 14 | /> | 21 | /> |
| 15 | </div> | 22 | </div> |
| 16 | </template> | 23 | </template> |
| @@ -18,6 +25,7 @@ | |||
| 18 | <script> | 25 | <script> |
| 19 | import Searcher from '@/components/searcher/Searcher.vue' | 26 | import Searcher from '@/components/searcher/Searcher.vue' |
| 20 | import GroupMaker from '@/components/group/GroupMaker.vue' | 27 | import GroupMaker from '@/components/group/GroupMaker.vue' |
| 28 | import GroupSender from '@/components/group/GroupSender.vue' | ||
| 21 | 29 | ||
| 22 | const popups = { | 30 | const popups = { |
| 23 | searcher_show: false, | 31 | searcher_show: false, |
| @@ -27,7 +35,8 @@ const popups = { | |||
| 27 | export default { | 35 | export default { |
| 28 | data() { | 36 | data() { |
| 29 | return { | 37 | return { |
| 30 | popups | 38 | popups, |
| 39 | groups: [] | ||
| 31 | } | 40 | } |
| 32 | }, | 41 | }, |
| 33 | 42 | ||
| @@ -44,7 +53,19 @@ export default { | |||
| 44 | hideSearcher() { this.popups.searcher_show = false }, | 53 | hideSearcher() { this.popups.searcher_show = false }, |
| 45 | 54 | ||
| 46 | toogleGroupShow() { this.popups.group_maker_show = !this.popups.group_maker_show }, | 55 | toogleGroupShow() { this.popups.group_maker_show = !this.popups.group_maker_show }, |
| 47 | hideGroup() { this.popups.group_maker_show = false } | 56 | hideGroup() { this.popups.group_maker_show = false }, |
| 57 | |||
| 58 | openGroup(group) { | ||
| 59 | let groups = this.groups.slice() | ||
| 60 | let index = groups.findIndex(o => o.name===group.name) | ||
| 61 | |||
| 62 | if(index >= 0) | ||
| 63 | groups.splice(index, 1) | ||
| 64 | else | ||
| 65 | groups.push(group) | ||
| 66 | |||
| 67 | this.groups = groups | ||
| 68 | } | ||
| 48 | }, | 69 | }, |
| 49 | 70 | ||
| 50 | computed: { | 71 | computed: { |
| @@ -63,7 +84,8 @@ export default { | |||
| 63 | 84 | ||
| 64 | components: { | 85 | components: { |
| 65 | Searcher, | 86 | Searcher, |
| 66 | GroupMaker | 87 | GroupMaker, |
| 88 | GroupSender | ||
| 67 | }, | 89 | }, |
| 68 | 90 | ||
| 69 | created() { | 91 | created() { |
