diff --git a/packages/taro-alipay/src/runtime.ts b/packages/taro-alipay/src/runtime.ts index d8cccb2f4fb4..a106709f3fba 100644 --- a/packages/taro-alipay/src/runtime.ts +++ b/packages/taro-alipay/src/runtime.ts @@ -1,5 +1,15 @@ import { mergeReconciler, mergeInternalComponents } from '@tarojs/shared' import { hostConfig, components } from './runtime-utils' +// 支付宝真机只有 navigator.swuserAgent +const { userAgent } = navigator +Object.defineProperty(navigator, 'userAgent', { + configurable: true, + enumerable: true, + get () { + return userAgent || (navigator as any).swuserAgent || '' + } +}) + mergeReconciler(hostConfig) mergeInternalComponents(components)