fix: 修复插件内使用 van-tabs 切换 tab 报错的问题 (#5073)

* 修复插件内使用van-tabs切换tab报错的问题

* fix(van-tabs): 修复小程序插件内使用van-tabs切换tab没有反应的问题
feat(van-tabs): incorrect style
docs(van-tabs): 去除utils,version里面require循环依赖,修复插件内调用wx.canIUse抛异常问题

* fix(van-tabs): 修复小程序插件内使用van-tabs切换tab没有反应的问题
feat(van-tabs): incorrect style
docs(van-tabs): 去除utils,version里面require循环依赖,修复插件内调用wx.canIUse抛异常问题

* fix(van-tabs): incorrect style
feat(van-tabs): incorrect style
docs(van-tabs): incorrect style
This commit is contained in:
cikenerd 2022-10-26 14:29:38 +08:00 committed by GitHub
parent a41e7734eb
commit 186b0156df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View File

@ -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;

View File

@ -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() {