更新记录
2.21.0(2025-07-01)
下载此版本
首次发布,详细请查看 ZEGO 官网。
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
√ |
√ |
- |
- |
5.0 |
12 |
× |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
√ |
√ |
√ |
√ |
- |
- |
- |
- |
- |
- |
- |
uni-app x
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
√ |
√ |
5.0 |
12 |
× |
√ |
其他
zego-zim-uts
开发文档
Native App 开发
Web、小程序开发
使用 SDK
import { ZIM, ZIMAppConfig, ZIMLoginConfig, ZIMMessage, ZIMMessageSendConfig, ZIMMessageSendNotification } from '@/uni_modules/zego-zim-uts';
// 创建实例
const appConfig: ZIMAppConfig = { appID: 0, appSign: '' };
ZIM.create(appConfig);
const zim = ZIM.getInstance();
// 注册回调事件
zim.onConnectionStateChanged((data) => console.log(`state: ${data.state}, event: ${data.event}`)));
// 登录
const userID = '';
const loginConfig: ZIMLoginConfig = { token: '', userName: '', customStatus: '', isOfflineLogin: false };
zim.login(userID, loginConfig)
.then(() => {
// 操作成功
})
.catch((err) => {
// 操作失败
console.error(err);
});
// 发送消息
const sendConfig: ZIMMessageSendConfig = { priority: 1 };
const notification: ZIMMessageSendNotification = {
onMessageAttached: (msg) => {},
};
const textMsg: ZIMMessage = {
type: 1,
message: 'test',
};
zim.sendMessage(textMsg, 'toUserID', 0, sendConfig, notification)
.then((res) => {
// 操作成功
})
.catch((err) => {
// 操作失败
console.error(err);
});
参考文档