mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-16 09:58:13 +08:00
34 lines
953 B
Vue
34 lines
953 B
Vue
<template>
|
|
<component
|
|
v-for="(ta, index) in parseAnnoContent(props.data)"
|
|
:key="index"
|
|
:is="getTaName(ta)"
|
|
:data="ta"
|
|
/>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { parseAnnoContent } from "../../web/utils/annoParser.js";
|
|
import TpBackupText from "../post/tp-backupText.vue";
|
|
import TpImage from "../post/tp-image.vue";
|
|
import TpText from "../post/tp-text.vue";
|
|
import TpTexts from "../post/tp-texts.vue";
|
|
import TpUnknown from "../post/tp-unknown.vue";
|
|
|
|
import TaTable from "./ta-table.vue";
|
|
|
|
interface TaParserProps {
|
|
data: TGApp.BBS.Announcement.ContentItem;
|
|
}
|
|
|
|
const props = defineProps<TaParserProps>();
|
|
|
|
function getTaName(ta: TGApp.Plugins.Mys.SctPost.Base) {
|
|
if (ta.children) return TpTexts;
|
|
if (typeof ta.insert === "string") return TpText;
|
|
if ("image" in ta.insert) return TpImage;
|
|
if ("backup_text" in ta.insert) return TpBackupText;
|
|
if ("table" in ta.insert) return TaTable;
|
|
return TpUnknown;
|
|
}
|
|
</script>
|