mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2026-07-07 23:21:08 +08:00
Compare commits
15 Commits
a41e7734eb
...
3049271aa5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3049271aa5 | ||
|
|
917e60195f | ||
|
|
c380b8ac32 | ||
|
|
e33a07730a | ||
|
|
72bd8b88fb | ||
|
|
4aacb6184c | ||
|
|
bbf2d0de31 | ||
|
|
aea30546dc | ||
|
|
b66b85eb97 | ||
|
|
186b0156df | ||
|
|
bbce66886c | ||
|
|
b1b2a9135c | ||
|
|
f70512cbf8 | ||
|
|
fe69d2d6cb | ||
|
|
ecbde11a51 |
@ -1,7 +1,8 @@
|
||||
import { isDef, isNumber, isPlainObject, isPromise } from './validator';
|
||||
import { canIUseGroupSetData, canIUseNextTick } from './version';
|
||||
import { canIUseGroupSetData, canIUseNextTick, getSystemInfoSync } from './version';
|
||||
|
||||
export { isDef } from './validator';
|
||||
export { getSystemInfoSync } from './version';
|
||||
|
||||
export function range(num: number, min: number, max: number) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
@ -17,15 +18,6 @@ export function nextTick(cb: (...args: any[]) => void) {
|
||||
}
|
||||
}
|
||||
|
||||
let systemInfo: WechatMiniprogram.SystemInfo;
|
||||
export function getSystemInfoSync() {
|
||||
if (systemInfo == null) {
|
||||
systemInfo = wx.getSystemInfoSync();
|
||||
}
|
||||
|
||||
return systemInfo;
|
||||
}
|
||||
|
||||
export function addUnit(value?: string | number): string | undefined {
|
||||
if (!isDef(value)) {
|
||||
return undefined;
|
||||
|
||||
@ -1,4 +1,11 @@
|
||||
import { getSystemInfoSync } from './utils';
|
||||
let systemInfo: WechatMiniprogram.SystemInfo;
|
||||
export function getSystemInfoSync() {
|
||||
if (systemInfo == null) {
|
||||
systemInfo = wx.getSystemInfoSync();
|
||||
}
|
||||
|
||||
return systemInfo;
|
||||
}
|
||||
|
||||
function compareVersion(v1, v2) {
|
||||
v1 = v1.split('.');
|
||||
@ -50,7 +57,11 @@ export function canIUseGroupSetData() {
|
||||
}
|
||||
|
||||
export function canIUseNextTick() {
|
||||
return wx.canIUse('nextTick');
|
||||
try {
|
||||
return wx.canIUse('nextTick');
|
||||
} catch (e) {
|
||||
return gte('2.7.1');
|
||||
}
|
||||
}
|
||||
|
||||
export function canIUseCanvas2d() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user