mizzkey/packages/frontend/src/components/page/page.block.vue

35 lines
811 B
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<component :is="getComponent(block.type)" :key="block.id" :page="page" :block="block" :h="h"/>
</template>
2023-05-14 03:50:21 +02:00
<script lang="ts" setup>
import { } from 'vue';
import * as Misskey from 'misskey-js';
import XText from './page.text.vue';
import XSection from './page.section.vue';
import XImage from './page.image.vue';
2020-11-15 05:42:04 +01:00
import XNote from './page.note.vue';
import { Block } from './block.type.js';
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;
}
}
2023-05-14 03:50:21 +02:00
defineProps<{
block: Block,
h: number,
page: Misskey.entities.Page,
}>();
</script>