diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2021-11-14 03:36:10 +0100 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2021-11-14 03:36:10 +0100 |
commit | 7f2f1e63826c0acb4514edfb1fbf7a884893f8c4 (patch) | |
tree | 3a9c5d0b74e698c00d9e0ce35b4e80721c8ad548 /src/views | |
parent | 319dd896f3a44237e1c26f3887fcb259f80f2714 (diff) | |
download | lom_frontend-7f2f1e63826c0acb4514edfb1fbf7a884893f8c4.tar.gz lom_frontend-7f2f1e63826c0acb4514edfb1fbf7a884893f8c4.zip |
Add command line
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/Home.vue | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/views/Home.vue b/src/views/Home.vue index 5a2a903..2954857 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue | |||
@@ -1,25 +1,49 @@ | |||
1 | <template> | 1 | <template> |
2 | <div class="home"> | 2 | <div class="home" v-hotkey="keymap"> |
3 | Hi {{get_username}}! | 3 | Hi {{get_username}}! |
4 | <input type="button" value="Logout!" @click="logout"> | 4 | <input type="button" value="Logout!" @click="logout"> |
5 | <Searcher v-if="show" @close="hide" /> | ||
5 | </div> | 6 | </div> |
6 | </template> | 7 | </template> |
7 | 8 | ||
8 | <script> | 9 | <script> |
10 | import Searcher from '@/components/Searcher.vue' | ||
11 | |||
9 | export default { | 12 | export default { |
13 | data() { | ||
14 | return { | ||
15 | show: false, | ||
16 | } | ||
17 | }, | ||
18 | |||
10 | methods: { | 19 | methods: { |
11 | logout() { | 20 | logout() { |
12 | this.$store.dispatch('logout') | 21 | this.$store.dispatch('logout') |
13 | this.$router.push('/login') | 22 | this.$router.push('/login') |
14 | } | 23 | }, |
24 | |||
25 | toogleShow() { this.show = !this.show }, | ||
26 | hide() { this.show = false } | ||
15 | }, | 27 | }, |
16 | 28 | ||
17 | computed: { | 29 | computed: { |
18 | get_username() { | 30 | get_username() { |
19 | return this.$store.getters['get_user'].username | 31 | return this.$store.getters['get_user'].username |
32 | }, | ||
33 | |||
34 | keymap() { | ||
35 | return { | ||
36 | 'ctrl+esc': this.toogleShow, | ||
37 | 'ctrl+shift+p': this.toogleShow, | ||
38 | 'esc': this.hide | ||
39 | } | ||
20 | } | 40 | } |
21 | }, | 41 | }, |
22 | 42 | ||
43 | components: { | ||
44 | Searcher | ||
45 | }, | ||
46 | |||
23 | created() { | 47 | created() { |
24 | if(!this.$store.getters['is_logged_in']) { | 48 | if(!this.$store.getters['is_logged_in']) { |
25 | this.$router.push('/login') | 49 | this.$router.push('/login') |