1 changed files with 27 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||
|
<template> |
||||
|
<template v-if="!Tools.isEmpty(slotContent) && typeof slotContent === 'object' && slotContent.componentType"> |
||||
|
<slot :name="slotName"> |
||||
|
<component :is="slotContent.componentType" v-bind="slotContent.attrs"></component> |
||||
|
</slot> |
||||
|
</template> |
||||
|
<template v-else> |
||||
|
<slot :name="slotName"> |
||||
|
<div v-html="Tools.isUndefinedOrNull(slotContent) ? '' : slotContent"></div> |
||||
|
</slot> |
||||
|
</template> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { Tools } from '@/platform'; |
||||
|
const props = defineProps({ |
||||
|
// 插槽名称 |
||||
|
slotName: { |
||||
|
type: String, |
||||
|
default: '', |
||||
|
}, |
||||
|
// 插槽内容 |
||||
|
slotContent: { |
||||
|
type: null, |
||||
|
default: '', |
||||
|
}, |
||||
|
}); |
||||
|
</script> |
Loading…
Reference in new issue