微信小程序支付功能打通

This commit is contained in:
2026-07-13 00:07:17 +08:00
parent f2cdc0222d
commit 450dc44d0e
14 changed files with 73 additions and 28 deletions
+2
View File
@@ -18,6 +18,8 @@ export function isWechatBrowser(): boolean {
/** 是否微信小程序 web-view 或独立小程序环境 */
export function isMiniProgram(): boolean {
const g = globalThis as typeof globalThis & { wx?: { requestPayment?: unknown } };
if (g.wx?.requestPayment) return true;
if (typeof window === 'undefined') return false;
const ua = navigator.userAgent.toLowerCase();
return ua.includes('miniprogram') || (window as Window & { __wxjs_environment?: string }).__wxjs_environment === 'miniprogram';