mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2026-07-12 01:11:05 +08:00
Compare commits
No commits in common. "3049271aa56f3e45eefc7fd67ea626c5418fe04a" and "a41e7734eb6186f59da2aae772b66d1aa35d53ea" have entirely different histories.
3049271aa5
...
a41e7734eb
@ -1,8 +1,7 @@
|
||||
import { isDef, isNumber, isPlainObject, isPromise } from './validator';
|
||||
import { canIUseGroupSetData, canIUseNextTick, getSystemInfoSync } from './version';
|
||||
import { canIUseGroupSetData, canIUseNextTick } 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);
|
||||
@ -18,6 +17,15 @@ 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,11 +1,4 @@
|
||||
let systemInfo: WechatMiniprogram.SystemInfo;
|
||||
export function getSystemInfoSync() {
|
||||
if (systemInfo == null) {
|
||||
systemInfo = wx.getSystemInfoSync();
|
||||
}
|
||||
|
||||
return systemInfo;
|
||||
}
|
||||
import { getSystemInfoSync } from './utils';
|
||||
|
||||
function compareVersion(v1, v2) {
|
||||
v1 = v1.split('.');
|
||||
@ -57,11 +50,7 @@ export function canIUseGroupSetData() {
|
||||
}
|
||||
|
||||
export function canIUseNextTick() {
|
||||
try {
|
||||
return wx.canIUse('nextTick');
|
||||
} catch (e) {
|
||||
return gte('2.7.1');
|
||||
}
|
||||
return wx.canIUse('nextTick');
|
||||
}
|
||||
|
||||
export function canIUseCanvas2d() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user