|
@@ -151,15 +151,16 @@
|
|
|
})
|
|
|
}
|
|
|
// 跳转到最后一条数据 与前面的:id进行对照
|
|
|
- this.$nextTick(function() {
|
|
|
- this.scrollToView = 'msg' + (this.unshiftmsg.length - 1)
|
|
|
+ that.$nextTick(function() {
|
|
|
+ that.scrollToView = 'msg' + (that.unshiftmsg.length - 1)
|
|
|
})
|
|
|
},
|
|
|
// 进行图片的预览
|
|
|
previewImg(e) {
|
|
|
+ const that = this;
|
|
|
let index = 0;
|
|
|
- for (let i = 0; i < this.imgMsg.length; i++) {
|
|
|
- if (this.imgMsg[i] == e) {
|
|
|
+ for (let i = 0; i < that.imgMsg.length; i++) {
|
|
|
+ if (that.imgMsg[i] == e) {
|
|
|
index = i;
|
|
|
}
|
|
|
}
|
|
@@ -167,7 +168,7 @@
|
|
|
// 预览图片
|
|
|
uni.previewImage({
|
|
|
current: index,
|
|
|
- urls: this.imgMsg,
|
|
|
+ urls: that.imgMsg,
|
|
|
longPressActions: {
|
|
|
itemList: ['发送给朋友', '保存图片', '收藏'],
|
|
|
success: function(data) {
|
|
@@ -181,6 +182,7 @@
|
|
|
},
|
|
|
//接受输入内容
|
|
|
inputs(e) {
|
|
|
+ const that = this;
|
|
|
//时间间隔处理
|
|
|
let data = {
|
|
|
"room": "1001",
|
|
@@ -192,26 +194,28 @@
|
|
|
// 发送给服务器消息
|
|
|
// onSendWS(JSON.stringify(data));
|
|
|
|
|
|
- this.unshiftmsg.push(data);
|
|
|
+ thatthat.unshiftmsg.push(data);
|
|
|
// 跳转到最后一条数据 与前面的:id进行对照
|
|
|
- this.$nextTick(function() {
|
|
|
- this.scrollToView = 'msg' + (this.unshiftmsg.length - 1)
|
|
|
+ that.$nextTick(function() {
|
|
|
+ that.scrollToView = 'msg' + (that.unshiftmsg.length - 1)
|
|
|
})
|
|
|
if (e.type == 1) {
|
|
|
- this.imgMsg.push(e.message);
|
|
|
+ that.imgMsg.push(e.message);
|
|
|
}
|
|
|
console.log(e)
|
|
|
},
|
|
|
//输入框高度
|
|
|
heights(e) {
|
|
|
- this.inputh = e;
|
|
|
- this.goBottom();
|
|
|
+ const that = this;
|
|
|
+ that.inputh = e;
|
|
|
+ that.goBottom();
|
|
|
},
|
|
|
// 滚动到底部
|
|
|
goBottom() {
|
|
|
- this.scrollToView = '';
|
|
|
- this.$nextTick(function() {
|
|
|
- this.scrollToView = 'msg' + (this.unshiftmsg.length - 1)
|
|
|
+ const that = this;
|
|
|
+ that.scrollToView = '';
|
|
|
+ that.$nextTick(function() {
|
|
|
+ that.scrollToView = 'msg' + (that.unshiftmsg.length - 1)
|
|
|
})
|
|
|
}
|
|
|
}
|