更新记录

2.26.2(2026-05-06) 下载此版本

修复 HBuildX 部分版本,因为不支持嵌套的结构定义导致的 Android 打自定义基座异常问题

2.26.1(2026-04-02) 下载此版本

Android、iOS 本地依赖库改为线上依赖

2.26.0(2026-01-13) 下载此版本

  1. 支持鸿蒙平台。
  2. 对齐 ZEGO 官网 2.26.0 版本。
查看更多

平台兼容性

uni-app(4.36)

Vue2 Vue2插件版本 Vue3 Vue3插件版本 Chrome Chrome插件版本 Safari Safari插件版本 app-vue app-vue插件版本 app-nvue app-nvue插件版本 Android Android插件版本 iOS iOS插件版本 鸿蒙 鸿蒙插件版本
√ 2.23.0 √ 2.23.0 √ 2.23.0 √ 2.23.0 √ 2.23.0 √ 2.23.0 5.0 2.23.0 12 2.23.0 √ 2.26.0
微信小程序 微信小程序插件版本 支付宝小程序 支付宝小程序插件版本 抖音小程序 抖音小程序插件版本 百度小程序 百度小程序插件版本 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
√ 2.23.0 √ 2.23.0 √ 2.23.0 √ 2.23.0 - - - - - - × ×

uni-app x(4.36)

Chrome Chrome插件版本 Safari Safari插件版本 Android Android插件版本 iOS iOS插件版本 鸿蒙 鸿蒙插件版本 微信小程序 微信小程序插件版本
√ 2.23.0 √ 2.23.0 5.0 2.23.0 12 2.23.0 √ 2.26.0 √ 2.23.0

其他

多语言 暗黑模式 宽屏模式 蒸汽模式
× × × √

zego-zim-uts

开发文档

Native App 开发

  • 制作自定义基座

Web、小程序开发

  • 切换到项目 uni_modules/zego-zim-uts 目录下,安装 npm sdk 库,安装成功后可以在该目录下看到 node_modules 目录
    cd uni_modules/zego-zim-uts/
    npm run install

使用 SDK

// <script>
import { ZIM, ZIMAppConfig, ZIMLoginConfig, ZIMMessage, ZIMMessageSendConfig, ZIMMessageSendNotification, ZIMConversationQueryConfig, ZIMMessageQueryConfig } from '@/uni_modules/zego-zim-uts';

export default {
    onShow() {
        this.useZIM();
    },
    methods: {
        useZIM() {
            // 创建实例
            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);
                });

            // 分页查询会话列表
            zim.queryConversationList({ count: 1, nextConversation: null } as ZIMConversationQueryConfig, null).then((res) => {
                console.log('queryConversationList-1', res);
                const conv = res.conversationList[res.conversationList.length - 1];
                const nextFlag = conv.type.toString() + conv.conversationID;
                zim.queryConversationList({ count: 1, nextConversation: nextFlag } as ZIMConversationQueryConfig, null).then((res) => {
                    console.log('queryConversationList-2', res);  
                });             
            });

            // 分页查询历史消息  
            zim.queryHistoryMessage(用户ID, 0, { count: 1, reverse: true, nextMessage: null } as ZIMMessageQueryConfig).then((res) => {
                console.log('queryHistoryMessage-1', res);
                const nextFlag = res.messageList[0]?.localMessageID;
                zim.queryHistoryMessage(用户ID, 0, { count: 1, reverse: true, nextMessage: nextFlag } as ZIMMessageQueryConfig).then((res) => {
                    console.log('queryHistoryMessage-2', res);  
                });                
            });
        }
    }
}
// </script>

参考文档

隐私、权限声明

1. 本插件需要申请的系统权限列表:

无

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

无

许可协议

MIT协议