diff options
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') |