From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/utils/tsxHelper.ts | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/utils/tsxHelper.ts b/src/utils/tsxHelper.ts
new file mode 100644
index 0000000..6087fa3
--- /dev/null
+++ b/src/utils/tsxHelper.ts
@@ -0,0 +1,16 @@
+import { Slots } from 'vue'
+import { isFunction } from '@/utils/is'
+
+export const getSlot = (slots: Slots, slot = 'default', data?: Recordable) => {
+ // Reflect.has 鍒ゆ柇涓�涓璞℃槸鍚﹀瓨鍦ㄦ煇涓睘鎬�
+ if (!slots || !Reflect.has(slots, slot)) {
+ return null
+ }
+ if (!isFunction(slots[slot])) {
+ console.error(`${slot} is not a function!`)
+ return null
+ }
+ const slotFn = slots[slot]
+ if (!slotFn) return null
+ return slotFn(data)
+}
--
Gitblit v1.8.0