diff --git a/ruoyi-ui/src/utils/imClient.js b/ruoyi-ui/src/utils/imClient.js index cf9ba08..947ad00 100644 --- a/ruoyi-ui/src/utils/imClient.js +++ b/ruoyi-ui/src/utils/imClient.js @@ -29,7 +29,10 @@ class ImClient { if (typeof window !== 'undefined' && typeof window.commonEventFunc !== 'function') { window.commonEventFunc = function () {} } - this.sdk = getSDK({ coreWasmPath: '/openIM.wasm', debug: false }) + // 用 BASE_URL 拼路径,部署到子目录时也能正确解析;线上 nginx 必须给 .wasm 配 application/wasm MIME + const base = (typeof process !== 'undefined' && process.env && process.env.BASE_URL) || '/' + const wasmUrl = base.replace(/\/?$/, '/') + 'openIM.wasm' + this.sdk = getSDK({ coreWasmPath: wasmUrl, debug: false }) this._wireEvents() }