From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期三, 05 三月 2025 17:29:42 +0800
Subject: [PATCH] -

---
 src/uni_modules/uview-plus/libs/function/index.js |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/src/uni_modules/uview-plus/libs/function/index.js b/src/uni_modules/uview-plus/libs/function/index.js
index d7a9975..7b208f3 100644
--- a/src/uni_modules/uview-plus/libs/function/index.js
+++ b/src/uni_modules/uview-plus/libs/function/index.js
@@ -50,7 +50,12 @@
  * @link 杩愯鏈熷垽鏂钩鍙� https://uniapp.dcloud.io/frame?id=鍒ゆ柇骞冲彴
  */
 export function os() {
+	// #ifdef APP || H5 || MP-WEIXIN
+	return uni.getDeviceInfo().platform.toLowerCase()
+	// #endif
+	// #ifndef APP || H5 || MP-WEIXIN
 	return uni.getSystemInfoSync().platform.toLowerCase()
+	// #endif
 }
 /**
  * @description 鑾峰彇绯荤粺淇℃伅鍚屾鎺ュ彛
@@ -58,6 +63,26 @@
  */
 export function sys() {
 	return uni.getSystemInfoSync()
+}
+export function getWindowInfo() {
+	let ret = {}
+	// #ifdef APP || H5 || MP-WEIXIN
+	ret = uni.getWindowInfo()
+	// #endif
+	// #ifndef APP || H5 || MP-WEIXIN
+	ret = sys()
+	// #endif
+	return ret
+}
+export function getDeviceInfo() {
+	let ret = {}
+	// #ifdef APP || H5 || MP-WEIXIN
+	ret = uni.getDeviceInfo()
+	// #endif
+	// #ifndef APP || H5 || MP-WEIXIN
+	ret = sys()
+	// #endif
+	return ret
 }
 
 /**
@@ -119,6 +144,7 @@
 	// 閫氳繃while鍘嗛亶锛岃繖閲屼富瑕佹槸涓轰簡H5闇�瑕佸灞傝В鏋愮殑闂
 	while (parent) {
 		// 鐖剁粍浠�
+        name = name.replace(/up-([a-zA-Z0-9-_]+)/g, 'u-$1')        
 		if (parent.$options && parent.$options.name !== name) {
 			// 濡傛灉缁勪欢鐨刵ame涓嶇浉绛夛紝缁х画涓婁竴绾у鎵�
 			parent = parent.$parent
@@ -181,8 +207,11 @@
 	if (!unit) {
 		unit = config.unit || 'px'
 	}
+	if (unit == 'rpx' && testNumber(String(value))) {
+		value = value * 2
+	}
 	value = String(value)
-	// 鐢╱View鍐呯疆楠岃瘉瑙勫垯涓殑number鍒ゆ柇鏄惁涓烘暟鍊�
+	// 鐢ㄥ唴缃獙璇佽鍒欎腑鐨刵umber鍒ゆ柇鏄惁涓烘暟鍊�
 	return testNumber(value) ? `${value}${unit}` : value
 }
 
@@ -690,12 +719,24 @@
 	return pages
 }
 
+export function getValueByPath(obj, path) {
+    // 灏嗚矾寰勫瓧绗︿覆鎸� '.' 鍒嗗壊鎴愭暟缁�
+    const pathArr = path.split('.');
+    // 浣跨敤 reduce 鏂规硶浠� obj 寮�濮嬶紝閫愮骇璁块棶宓屽灞炴��
+    return pathArr.reduce((acc, curr) => {
+        // 濡傛灉褰撳墠绱姞鍣紙acc锛夋槸瀵硅薄涓斿寘鍚綋鍓嶉敭锛坈urr锛夛紝鍒欒繑鍥炶閿搴旂殑鍊�
+        // 鍚﹀垯杩斿洖 undefined锛堣〃绀鸿矾寰勪笉瀛樺湪锛�
+        return acc && acc[curr] !== undefined ? acc[curr] : undefined;
+    }, obj);
+}
+
 export default {
 	range,
 	getPx,
 	sleep,
 	os,
 	sys,
+	getWindowInfo,
 	random,
 	guid,
 	$parent,
@@ -720,5 +761,6 @@
 	setProperty,
 	page,
 	pages,
+	getValueByPath,
 	// setConfig
 }

--
Gitblit v1.9.1