From 55bf797dcc730b37bc691ebab2b51ff9db8ed245 Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周二, 06 5月 2025 17:37:23 +0800
Subject: [PATCH] 修改代码样式

---
 HIAWms/web/src/provider/index.ts |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/HIAWms/web/src/provider/index.ts b/HIAWms/web/src/provider/index.ts
new file mode 100644
index 0000000..d8537dd
--- /dev/null
+++ b/HIAWms/web/src/provider/index.ts
@@ -0,0 +1,55 @@
+import { Component, DefineComponent, h } from 'vue'
+import Provider from './index.vue'
+/**
+ *
+ * @param Widget 缁勪欢
+ * @param data  notPage 鏄惁涓虹粍浠� | NestedComponents 宓屽缁勪欢
+ * @param isFullyCover 鏄惁閾烘弧
+ * @param defaultConfig 榛樿鏍峰紡閰嶇疆锛屾敮鎸亀idth,height,padding,background
+ * @returns
+ */
+export function provider(
+  Widget: Component,
+  data: boolean | Component = false,
+  isFullyCover: boolean = false,
+  defaultConfig: Record<string, any> = {}
+) {
+  // const v = typeof notPage === 'boolean' ? notPage :
+  let notPage
+  let NestedComponents
+  if (typeof data === 'boolean') {
+    notPage === !!data
+  }
+  if (typeof data === 'object' || typeof data === 'function') {
+    NestedComponents = data
+  }
+  return (arg: any) => {
+    return h(
+      Provider,
+      {
+        widgetProps: arg,
+        widgetName: Widget.name,
+        isFullyCover,
+        notPage,
+        defaultConfig,
+        NestedComponents,
+      },
+      {
+        default: !NestedComponents
+          ? (props) => {
+              return h(Widget, props)
+            }
+          : null,
+        nested: NestedComponents
+          ? (props: any) => {
+              return h(NestedComponents, props, {
+                default: (childProps) => {
+                  return h(Widget, { ...props, ...childProps })
+                },
+              })
+            }
+          : null,
+      }
+    )
+  }
+}

--
Gitblit v1.9.3