parent
a6cd97ca9a
commit
f2d9e3105d
3 changed files with 23 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<component :is="'x-' + block.type" :key="block.id" :page="page" :block="block" :h="h"/>
|
||||
<component :is="getComponent(block.type)" :key="block.id" :page="page" :block="block" :h="h"/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
@ -11,6 +11,16 @@ import XImage from './page.image.vue';
|
|||
import XNote from './page.note.vue';
|
||||
import { Block } from './block.type';
|
||||
|
||||
function getComponent(type: string) {
|
||||
switch (type) {
|
||||
case 'text': return XText;
|
||||
case 'section': return XSection;
|
||||
case 'image': return XImage;
|
||||
case 'note': return XNote;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
defineProps<{
|
||||
block: Block,
|
||||
h: number,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue