2019-10-29 07:20:54 +00:00
|
|
|
<template>
|
2019-11-12 04:39:24 +00:00
|
|
|
<div class="conversation--container">
|
|
|
|
<div class="conversation-wrap">
|
|
|
|
<ChatMessage
|
|
|
|
v-for="message in messages"
|
|
|
|
:key="message.id"
|
|
|
|
:message="message"
|
|
|
|
/>
|
|
|
|
</div>
|
2019-11-12 04:16:30 +00:00
|
|
|
<branding></branding>
|
2019-11-12 04:39:24 +00:00
|
|
|
</div>
|
2019-10-29 07:20:54 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-12 04:16:30 +00:00
|
|
|
import Branding from 'widget/components/Branding.vue';
|
2019-10-29 07:20:54 +00:00
|
|
|
import ChatMessage from 'widget/components/ChatMessage.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ConversationWrap',
|
|
|
|
components: {
|
2019-11-12 04:16:30 +00:00
|
|
|
Branding,
|
2019-10-29 07:20:54 +00:00
|
|
|
ChatMessage,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
messages: Object,
|
|
|
|
},
|
2019-11-09 11:42:31 +00:00
|
|
|
mounted() {
|
|
|
|
this.scrollToBottom();
|
|
|
|
},
|
|
|
|
updated() {
|
|
|
|
this.scrollToBottom();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
scrollToBottom() {
|
|
|
|
const container = this.$el;
|
|
|
|
container.scrollTop =
|
|
|
|
container.scrollHeight < this.minScrollHeight
|
|
|
|
? this.minScrollHeight
|
|
|
|
: container.scrollHeight;
|
|
|
|
},
|
|
|
|
},
|
2019-10-29 07:20:54 +00:00
|
|
|
};
|
|
|
|
</script>
|
2019-11-12 04:39:24 +00:00
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
@import '~widget/assets/scss/woot.scss';
|
|
|
|
|
|
|
|
.conversation--container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex: 1;
|
|
|
|
overflow-y: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.conversation-wrap {
|
|
|
|
flex: 1;
|
|
|
|
padding: $space-large $space-small $zero $space-small;
|
|
|
|
}
|
|
|
|
</style>
|