// App WebView(尤其旧版 Android)可能没有 TextEncoder,先做兼容再加载其它模块 const g = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : (typeof self !== "undefined" ? self : {}); if (typeof (g as any).TextEncoder === "undefined") { (g as any).TextEncoder = class TextEncoder { encode(s = "") { const u8: number[] = []; for (let i = 0; i < s.length; i++) { let c = s.charCodeAt(i); if (c < 0x80) u8.push(c); else if (c < 0x800) { u8.push(0xc0 | (c >> 6), 0x80 | (c & 0x3f)); } else if (c < 0xd800 || c >= 0xe000) { u8.push(0xe0 | (c >> 12), 0x80 | ((c >> 6) & 0x3f), 0x80 | (c & 0x3f)); } else { i++; const c2 = s.charCodeAt(i); const u = ((c & 0x3ff) << 10) + (c2 & 0x3ff) + 0x10000; u8.push(0xf0 | (u >> 18), 0x80 | ((u >> 12) & 0x3f), 0x80 | ((u >> 6) & 0x3f), 0x80 | (u & 0x3f)); } } return new Uint8Array(u8); } }; } if (typeof (g as any).TextDecoder === "undefined") { (g as any).TextDecoder = class TextDecoder { decode() { return ""; } }; } import { createSSRApp } from "vue"; import App from "./App.vue"; import i18n from "./utils/i18n"; export function createApp() { const app = createSSRApp(App); app.use(i18n); return { app, }; }