From af930887f9972b7dd21c80599e697e44f5e5a579 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 13 十一月 2024 14:05:04 +0800
Subject: [PATCH] 移除视频相关组件
---
miniprogram_npm/tdesign-miniprogram/common/utils.js | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/common/utils.js b/miniprogram_npm/tdesign-miniprogram/common/utils.js
index 2d6daef..95dcaf7 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/utils.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/utils.js
@@ -1,5 +1,5 @@
import { prefix } from './config';
-const systemInfo = wx.getSystemInfoSync();
+export const systemInfo = wx.getSystemInfoSync();
export const debounce = function (func, wait = 500) {
let timerId;
return function (...rest) {
@@ -67,9 +67,8 @@
.join('; ');
};
export const getAnimationFrame = function (context, cb) {
- return wx
+ return context
.createSelectorQuery()
- .in(context)
.selectViewport()
.boundingClientRect()
.exec(() => {
@@ -78,8 +77,8 @@
};
export const getRect = function (context, selector, needAll = false) {
return new Promise((resolve, reject) => {
- wx.createSelectorQuery()
- .in(context)[needAll ? 'selectAll' : 'select'](selector)
+ context
+ .createSelectorQuery()[needAll ? 'selectAll' : 'select'](selector)
.boundingClientRect((rect) => {
if (rect) {
resolve(rect);
@@ -91,11 +90,15 @@
.exec();
});
};
-const isDef = function (value) {
- return value !== undefined && value !== null;
-};
export const isNumber = function (value) {
return /^\d+(\.\d+)?$/.test(value);
+};
+export const isNull = function (value) {
+ return value === null;
+};
+export const isUndefined = (value) => typeof value === 'undefined';
+export const isDef = function (value) {
+ return !isUndefined(value) && !isNull(value);
};
export const addUnit = function (value) {
if (!isDef(value)) {
@@ -104,8 +107,9 @@
value = String(value);
return isNumber(value) ? `${value}px` : value;
};
-export const getCharacterLength = (type, str, max) => {
- if (!str || str.length === 0) {
+export const getCharacterLength = (type, char, max) => {
+ const str = String(char !== null && char !== void 0 ? char : '');
+ if (str.length === 0) {
return {
length: 0,
characters: '',
@@ -168,7 +172,7 @@
}
return parseInt(value, 10);
}
- return value;
+ return value !== null && value !== void 0 ? value : 0;
};
export const setIcon = (iconName, icon, defaultIcon) => {
if (icon) {
@@ -231,3 +235,11 @@
const computedSize = typeof sizeLimit === 'number' ? sizeLimit * base : (sizeLimit === null || sizeLimit === void 0 ? void 0 : sizeLimit.size) * unitMap[(_a = sizeLimit === null || sizeLimit === void 0 ? void 0 : sizeLimit.unit) !== null && _a !== void 0 ? _a : 'KB'];
return size > computedSize;
};
+export const rpx2px = (rpx) => Math.floor((systemInfo.windowWidth * rpx) / 750);
+export const nextTick = () => {
+ return new Promise((resolve) => {
+ wx.nextTick(() => {
+ resolve();
+ });
+ });
+};
--
Gitblit v1.9.3