|
@@ -71,6 +71,7 @@ export default {
|
|
|
created() {
|
|
|
this.search();
|
|
|
},
|
|
|
+ mounted() {},
|
|
|
methods: {
|
|
|
...clientApply(['query']),
|
|
|
...mapChat(['create']),
|
|
@@ -84,11 +85,12 @@ export default {
|
|
|
let arr = await this.chatQuery({ client_id: this.customer.client_id, customer_id: this.customer.customer_id });
|
|
|
if (this.$checkRes(arr)) {
|
|
|
this.$set(this, `list`, arr.data);
|
|
|
+ this.scrollToBottom();
|
|
|
}
|
|
|
},
|
|
|
// 区分发言人
|
|
|
isSender(data) {
|
|
|
- return data.customer_id != this.customer.customer_id;
|
|
|
+ return data.sender_id == this.customer.customer_id;
|
|
|
},
|
|
|
// 发言
|
|
|
async send() {
|
|
@@ -126,8 +128,15 @@ export default {
|
|
|
if (body) {
|
|
|
body = JSON.parse(body);
|
|
|
this.list.push(body);
|
|
|
+ this.scrollToBottom();
|
|
|
}
|
|
|
},
|
|
|
+ scrollToBottom: function () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ var container = this.$el.querySelector('.one');
|
|
|
+ container.scrollTop = container.scrollHeight;
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|