mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-21 22:45:07 +08:00
feat: add vue3(element-plus)
This commit is contained in:
16
yudao-ui-admin-vue3/src/utils/tsxHelper.ts
Normal file
16
yudao-ui-admin-vue3/src/utils/tsxHelper.ts
Normal file
@ -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)
|
||||
}
|
Reference in New Issue
Block a user