From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/components/DiyEditor/components/mobile/index.ts |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/src/components/DiyEditor/components/mobile/index.ts b/src/components/DiyEditor/components/mobile/index.ts
new file mode 100644
index 0000000..c0dc67d
--- /dev/null
+++ b/src/components/DiyEditor/components/mobile/index.ts
@@ -0,0 +1,61 @@
+/*
+ * 缁勪欢娉ㄥ唽
+ *
+ * 缁勪欢瑙勮寖锛�
+ * 1. 姣忎釜瀛愮洰褰曞氨鏄竴涓嫭绔嬬殑缁勪欢锛屾瘡涓洰褰曞寘鎷互涓嬩笁涓枃浠讹細
+ * 2. config.ts锛氱粍浠堕厤缃紝蹇呴�夛紝鐢ㄤ簬瀹氫箟缁勪欢銆佺粍浠堕粯璁ょ殑灞炴�с�佸畾涔夊睘鎬х殑绫诲瀷
+ * 3. index.vue锛氱粍浠跺睍绀猴紝鐢ㄤ簬灞曠ず缁勪欢鐨勬覆鏌撴晥鏋溿�傚彲浠ヤ笉鎻愪緵锛屽 Page锛堥〉闈㈣缃級锛屽彧闇�瑕佸睘鎬ч厤缃〃鍗曞嵆鍙�
+ * 4. property.vue锛氱粍浠跺睘鎬ц〃鍗曪紝鐢ㄤ簬閰嶇疆缁勪欢锛屽繀閫夛紝
+ *
+ * 娉細
+ * 缁勪欢ID浠onfig.ts涓厤缃殑id涓哄噯锛屼笌缁勪欢鐩綍鐨勫悕绉版棤鍏筹紝浣嗚繕鏄缓璁粍浠剁洰褰曠殑鍚嶇О涓庣粍浠禝D淇濇寔涓�鑷�
+ */
+
+// 瀵煎叆缁勪欢鐣岄潰妯″潡
+const viewModules: Record<string, any> = import.meta.glob('./*/*.vue')
+// 瀵煎叆閰嶇疆妯″潡
+const configModules: Record<string, any> = import.meta.glob('./*/config.ts', { eager: true })
+
+// 鐣岄潰妯″潡
+const components = {}
+// 缁勪欢閰嶇疆妯″潡
+const componentConfigs = {}
+
+// 缁勪欢鐣岄潰鐨勭被鍨�
+type ViewType = 'index' | 'property'
+
+/**
+ * 娉ㄥ唽缁勪欢鐨勭晫闈㈡ā鍧�
+ *
+ * @param componentId 缁勪欢ID
+ * @param configPath 閰嶇疆妯″潡鐨勬枃浠惰矾寰�
+ * @param viewType 缁勪欢鐣岄潰鐨勭被鍨�
+ */
+const registerComponentViewModule = (
+  componentId: string,
+  configPath: string,
+  viewType: ViewType
+) => {
+  const viewPath = configPath.replace('config.ts', `${viewType}.vue`)
+  const viewModule = viewModules[viewPath]
+  if (viewModule) {
+    // 瀹氫箟寮傛缁勪欢
+    components[componentId] = defineAsyncComponent(viewModule)
+  }
+}
+
+// 娉ㄥ唽
+Object.keys(configModules).forEach((modulePath: string) => {
+  const component = configModules[modulePath].component
+  const componentId = component?.id
+  if (componentId) {
+    // 娉ㄥ唽缁勪欢
+    componentConfigs[componentId] = component
+    // 娉ㄥ唽棰勮鐣岄潰
+    registerComponentViewModule(componentId, modulePath, 'index')
+    // 娉ㄥ唽灞炴�ч厤缃〃鍗�
+    registerComponentViewModule(`${componentId}Property`, modulePath, 'property')
+  }
+})
+
+export { components, componentConfigs }

--
Gitblit v1.8.0