From 5b9bc11ba913333c6f6cb3af071150bdb0d8d589 Mon Sep 17 00:00:00 2001 From: mehaotian <490272692@qq.com> Date: Tue, 24 Sep 2019 17:24:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(stat):=20getAccountInfoSync=20=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BD=8E?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=9F=BA=E7=A1=80=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-stat/dist/index.js | 9 ++++++--- packages/uni-stat/src/parameter.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/uni-stat/dist/index.js b/packages/uni-stat/dist/index.js index 43dfe1ec9..e6123a3a2 100644 --- a/packages/uni-stat/dist/index.js +++ b/packages/uni-stat/dist/index.js @@ -82,9 +82,12 @@ const getPlatformName = () => { }; const getPackName = () => { - let packName = ''; - if (getPlatformName() === 'wx' || getPlatformName() === 'qq') { - packName = uni.getAccountInfoSync().miniProgram.appId || ''; + let packName = ''; + if (getPlatformName() === 'wx' || getPlatformName() === 'qq') { + // 兼容微信小程序低版本基础库 + if(uni.canIUse('getAccountInfoSync')){ + packName = uni.getAccountInfoSync().miniProgram.appId || ''; + } } return packName }; diff --git a/packages/uni-stat/src/parameter.js b/packages/uni-stat/src/parameter.js index 81f1b7c26..1a4c8cdc5 100644 --- a/packages/uni-stat/src/parameter.js +++ b/packages/uni-stat/src/parameter.js @@ -78,9 +78,12 @@ export const getPlatformName = () => { } export const getPackName = () => { - let packName = '' - if (getPlatformName() === 'wx' || getPlatformName() === 'qq') { - packName = uni.getAccountInfoSync().miniProgram.appId || '' + let packName = '' + if (getPlatformName() === 'wx' || getPlatformName() === 'qq') { + // 兼容微信小程序低版本基础库 + if(uni.canIUse('getAccountInfoSync')){ + packName = uni.getAccountInfoSync().miniProgram.appId || ''; + } } return packName } -- GitLab