1 |
- {"version":3,"sources":["../src/common/version.ts"],"names":[],"mappings":"AAyCA,wBAAgB,sBAAsB,YAGrC","file":"version.d.ts","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"]}
|