注册

vue+聊天各种未定义


rsendPrivateText() {
var id = conn.getUniqueId(); // 生成本地消息id
var msg = new WebIM.message('txt', id); // 创建文本消息
msg.set({
msg: this.txt, // 消息内容
to: 'hsl_17794571243', // 接收消息对象(用户id)
roomType: false,
success: function(id, serverMsgId) {
console.log('send private text Success');
},
fail: function(e) {
console.log("Send private text error");
},
});
msg.body.chatType = 'singleChat';
conn.send(msg.body);
console.log()
this.txt = ''
},
运行时conn未定义,给conn加上this就报错getUniqueId()未定义。在conn加上Vue.prototype就报错Cannot read property 'split' of undefined
已邀请:

要回复问题请先登录注册