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/index.js |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/uni_modules/uview-plus/index.js b/src/uni_modules/uview-plus/index.js
index 01179c4..62c49b8 100644
--- a/src/uni_modules/uview-plus/index.js
+++ b/src/uni_modules/uview-plus/index.js
@@ -77,11 +77,48 @@
     platform
 }
 
-// $u鎸傝浇鍒皍ni瀵硅薄涓�
-uni.$u = $u
+export const mount$u = function() {
+    uni.$u = $u
+}
+
+// #ifdef H5
+const importFn = import.meta.glob('./components/u-*/u-*.vue', { eager: true })
+let components = [];
+
+// 鎵归噺娉ㄥ唽鍏ㄥ眬缁勪欢
+for (const key in importFn) {
+    let component = importFn[key].default;
+    if (component.name && component.name.indexOf('u--') !== 0) {
+        component.install = function (Vue) {
+            Vue.component(name, component);
+        };
+        
+        // 瀵煎叆缁勪欢
+        components.push(component);
+    }
+}
+// #endif
+
+function toCamelCase(str) {
+    return str.replace(/-([a-z])/g, function(match, group1) {
+      return group1.toUpperCase();
+    }).replace(/^[a-z]/, function(match) {
+      return match.toUpperCase();
+    });
+}
 
 const install = (Vue) => {
+    // #ifdef H5
+    components.forEach(function(component) {
+        const name = component.name.replace(/u-([a-zA-Z0-9-_]+)/g, 'up-$1');
+        Vue.component(name, component); 
+    });
+    // #endif
+
     // 鍚屾椂鎸傝浇鍒皍ni鍜孷ue.prototype涓�
+    // $u鎸傝浇鍒皍ni瀵硅薄涓�
+    uni.$u = $u
+
     // #ifndef APP-NVUE
     // 鍙湁vue锛屾寕杞藉埌Vue.prototype鎵嶆湁鎰忎箟锛屽洜涓簄vue涓叏灞�Vue.prototype鍜孷ue.mixin鏄棤鏁堢殑
     Vue.config.globalProperties.$u = $u

--
Gitblit v1.9.1