上vue代码
methods: {
sendMessages (m) {
var that = this
this.currentConversation.then(function(me) {
// 创建与Jerry之间的对话
return me.createConversation({
members: ['1470xxxxxxxx'],
name: 'im1371',
});
}).then(function(conversation) {
// 发送消息
// console.log(this.textareaValue, textareaValue)
return conversation.send(new TextMessage(m));
// console.log(conversation, 'this is !!!!!!!!!!')
}).then(function(message) {
console.log( message, '发送成功!');
that.messages.push(message)
}).catch(console.error);
this.textareaValue = ''
},
},
mounted() {
this.currentConversation = realtime.createIMClient(this.userId);
}