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iB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,OAAO,GAAW,QAAQ,CAAC;IACjC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC","file":"version.js","sourcesContent":["// 获取系统信息\nlet systemInfo: WechatMiniprogram.SystemInfo;\nfunction getSystemInfo() {\n if (systemInfo == null) {\n systemInfo = wx.getSystemInfoSync();\n }\n return systemInfo;\n}\n\n// 版本号比较, 参考:https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html\nfunction compareVersion(v1, v2) {\n v1 = v1.split('.');\n v2 = v2.split('.');\n const len = Math.max(v1.length, v2.length);\n\n while (v1.length < len) {\n v1.push('0');\n }\n while (v2.length < len) {\n v2.push('0');\n }\n\n for (let i = 0; i < len; i++) {\n const num1 = parseInt(v1[i]);\n const num2 = parseInt(v2[i]);\n\n if (num1 > num2) {\n return 1;\n } else if (num1 < num2) {\n return -1;\n }\n }\n\n return 0;\n}\n\nfunction judgeByVersion(version: string) {\n const currentSDKVersion = getSystemInfo().SDKVersion;\n return compareVersion(currentSDKVersion, version) >= 0;\n}\n\nexport function canIUseFormFieldButton() {\n const version: string = '2.10.3';\n return judgeByVersion(version);\n}\n"]}
|