uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改

This commit is contained in:
2025-10-21 10:44:31 +08:00
parent 5d98b7efc2
commit 5f3a307fec
395 changed files with 31264 additions and 2477 deletions

View File

@@ -0,0 +1,21 @@
// @ts-nocheck
/**
* 将一个或多个元素转换为数组
* @param item 要转换为数组的元素
* @returns 转换后的数组
*/
// #ifndef UNI-APP-X && APP
export const toArray = <T>(item: T | T[]): T[] => Array.isArray(item) ? item : [item];
// #endif
// #ifdef UNI-APP-X && APP
export function toArray<T extends any>(item: any): T[] {
return Array.isArray(item) ? item as T[] : [item as T]// as T[]
};
// #endif
// 示例
// console.log(toArray(5)); // 输出: [5]
// console.log(toArray("hello")); // 输出: ["hello"]
// console.log(toArray([1, 2, 3])); // 输出: [1, 2, 3]
// console.log(toArray(["apple", "banana"])); // 输出: ["apple", "banana"]