Skip to content
Snippets Groups Projects
Commit cec58f1c authored by Endrizzi, Marco (UG - Comp Sci & Elec Eng)'s avatar Endrizzi, Marco (UG - Comp Sci & Elec Eng)
Browse files

Bug fixing and optimization

- Send message footer no longer disappears when you send a message
- A watcher has been added to automatically scroll the page
parent 2ac13d01
No related branches found
No related tags found
No related merge requests found
<template lang="pug"> <template lang="pug">
q-page.q-pa-lg.column.justify-end.page-chat(ref='pageChat') q-page.q-pa-lg.q-mb-xl.column.justify-end.page-chat(ref='pageChat')
q-chat-message.text-weight-light( q-chat-message.text-weight-light(
v-for='(message, key) in messages', v-for='(message, key) in messages',
:key='key', :key='key',
...@@ -11,19 +11,18 @@ q-page.q-pa-lg.column.justify-end.page-chat(ref='pageChat') ...@@ -11,19 +11,18 @@ q-page.q-pa-lg.column.justify-end.page-chat(ref='pageChat')
avatar='https://cdn.quasar.dev/img/avatar1.jpg' avatar='https://cdn.quasar.dev/img/avatar1.jpg'
) )
q-footer(elevated) q-footer(elevated)
q-toolbar .fixed-bottom.q-pa-xs.bg-primary.q-px-sm
q-form.full-width(@submit='sendMessage') q-form.full-width.row(@submit='sendMessage')
.row q-input.col-11(
q-input.col-11( v-model='newMessage',
v-model='newMessage', ref='newMessage',
ref='newMessage', bg-color='white',
bg-color='white', outlined,
outlined, rounded,
rounded, label='Message',
label='Message', dense
dense )
) q-btn.col-1(type='submit', icon='send', color='white', round, dense, flat)
q-btn.col-1(type='submit', icon='send', color='white', round, dense, flat)
</template> </template>
<script> <script>
...@@ -58,7 +57,6 @@ export default { ...@@ -58,7 +57,6 @@ export default {
otherUserId: this.$route.params.otherUserId otherUserId: this.$route.params.otherUserId
}) })
this.clearMessage() this.clearMessage()
this.scrollToBottom()
}, },
clearMessage() { clearMessage() {
...@@ -80,11 +78,17 @@ export default { ...@@ -80,11 +78,17 @@ export default {
...mapState('firebase', ['messages', 'userDetails']) ...mapState('firebase', ['messages', 'userDetails'])
}, },
watch: {
messages: {
deep: true,
handler() {
this.scrollToBottom()
}
}
},
mounted() { mounted() {
this.firebaseGetMessages(this.$route.params.otherUserId) this.firebaseGetMessages(this.$route.params.otherUserId)
setTimeout(() => {
this.scrollToBottom()
}, 150)
}, },
// Fire when the user leaves the page // Fire when the user leaves the page
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment