diff --git a/ruoyi-ui/src/utils/imClient.js b/ruoyi-ui/src/utils/imClient.js index 65715be..cf9ba08 100644 --- a/ruoyi-ui/src/utils/imClient.js +++ b/ruoyi-ui/src/utils/imClient.js @@ -24,6 +24,11 @@ class ImClient { if (this.loginPromise) return this.loginPromise if (!this.sdk) { + // 兜底:某些时机下 wasm 会先调 window.commonEventFunc 再被 SDK 覆盖, + // 提前挂一个空 stub 避免 "window.commonEventFunc is not a function" + if (typeof window !== 'undefined' && typeof window.commonEventFunc !== 'function') { + window.commonEventFunc = function () {} + } this.sdk = getSDK({ coreWasmPath: '/openIM.wasm', debug: false }) this._wireEvents() }