* 判断版本号是否小于 V2.15.0 小于返回true * @param {*} version * @returns
(version)
| 705 | * @returns |
| 706 | */ |
| 707 | function compareVersion(version) { |
| 708 | const currentVersion = 'v2.12.2'; |
| 709 | const current = currentVersion.substring(1).split('.'); |
| 710 | const target = version.substring(1).split('.'); |
| 711 | for (let i = 0; i < current.length; i++) { |
| 712 | const c = parseInt(current[i]); |
| 713 | const t = parseInt(target[i] || 0); |
| 714 | if (c > t) { |
| 715 | return true; |
| 716 | } else if (c < t) { |
| 717 | return false; |
| 718 | } |
| 719 | } |
| 720 | return false; |
| 721 | } |
| 722 | /** |
| 723 | * 16位随机数 |
| 724 | * @returns |