From c6b4c6a90a3bb77add64994f51d3e2af790c8452 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Fri, 17 Dec 2021 00:22:38 +0100 Subject: make styles and add some features --- src/components/group/GroupMaker.vue | 21 +++++++++--- src/components/group/GroupSender.vue | 62 +++++++++++++++++++++++++---------- src/components/group/Message.vue | 20 +++-------- src/components/searcher/Searcher.vue | 41 +++++------------------ src/components/searcher/Sugestion.vue | 21 +----------- 5 files changed, 76 insertions(+), 89 deletions(-) (limited to 'src/components') diff --git a/src/components/group/GroupMaker.vue b/src/components/group/GroupMaker.vue index f3da293..06963e3 100644 --- a/src/components/group/GroupMaker.vue +++ b/src/components/group/GroupMaker.vue @@ -1,15 +1,17 @@ @@ -69,6 +73,15 @@ export default { this.close() console.log(this.users) + }, + + hotkeys(e) { + switch(e.code) { + case 'Delete': + e.preventDefault() + this.$emit('close') + break + } } }, diff --git a/src/components/group/GroupSender.vue b/src/components/group/GroupSender.vue index ba36949..a815561 100644 --- a/src/components/group/GroupSender.vue +++ b/src/components/group/GroupSender.vue @@ -1,12 +1,25 @@ @@ -20,6 +33,7 @@ export default { return { message: "", messages: [], + isFocus: false } }, @@ -45,13 +59,38 @@ export default { console.log(data) - if(status===200) + if(status===200){ this.messages = data.messages + this.scroll_down() + } }, push_message(message) { - if(message.receiver == this.group.id) + if(message.receiver == this.group.id){ this.messages.push(message) + this.scroll_down() + } + }, + + scroll_down() { + this.$nextTick(function () { + const messages = this.$refs.messages + console.log(messages) + messages.scrollTop = messages.scrollHeight + }) + }, + + hotkeys(e) { + switch(e.code) { + case 'Delete': + e.preventDefault() + this.$emit('close', this.group.id) + break + case 'Escape': + e.preventDefault() + this.$refs.input.blur() + break + } } }, @@ -72,14 +111,3 @@ export default { } } - - diff --git a/src/components/group/Message.vue b/src/components/group/Message.vue index eedcc6e..556deb9 100644 --- a/src/components/group/Message.vue +++ b/src/components/group/Message.vue @@ -1,8 +1,8 @@ @@ -29,15 +29,3 @@ export default { } } - - diff --git a/src/components/searcher/Searcher.vue b/src/components/searcher/Searcher.vue index f8dd51f..e74600a 100644 --- a/src/components/searcher/Searcher.vue +++ b/src/components/searcher/Searcher.vue @@ -1,7 +1,8 @@ @@ -72,7 +73,11 @@ export default { hotkeys(e) { switch(e.code) { - case 'Escape': + case 'Escape': + e.preventDefault() + this.close() + break + case 'Delete': e.preventDefault() this.close() break @@ -127,31 +132,3 @@ export default { } } - - diff --git a/src/components/searcher/Sugestion.vue b/src/components/searcher/Sugestion.vue index 4721ca2..15a177d 100644 --- a/src/components/searcher/Sugestion.vue +++ b/src/components/searcher/Sugestion.vue @@ -1,5 +1,5 @@ @@ -9,24 +9,5 @@ export default { props: { sugestion: Array }, - - created() { - this.$nextTick(function () { - }) - } - } - - -- cgit v1.2.3