62 lines
1.4 KiB
Vue
62 lines
1.4 KiB
Vue
<template>
|
|
<div class="voxdxuby">
|
|
<XNote
|
|
v-if="note && !block.detailed"
|
|
:key="note.id + ':normal'"
|
|
v-model:note="note"
|
|
/>
|
|
<XNoteDetailed
|
|
v-if="note && block.detailed"
|
|
:key="note.id + ':detail'"
|
|
v-model:note="note"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, onMounted, PropType, Ref, ref } from "vue";
|
|
import XNote from "@/components/MagNote.vue";
|
|
import XNoteDetailed from "@/components/MagNoteDetailed.vue";
|
|
import * as os from "@/os";
|
|
import { NoteBlock } from "@/scripts/hpml/block";
|
|
import { endpoints, packed } from "magnetar-common";
|
|
|
|
export default defineComponent({
|
|
components: {
|
|
XNote,
|
|
XNoteDetailed,
|
|
},
|
|
props: {
|
|
block: {
|
|
type: Object as PropType<NoteBlock>,
|
|
required: true,
|
|
},
|
|
},
|
|
setup(props, ctx) {
|
|
const note: Ref<packed.PackNoteMaybeFull | null> = ref(null);
|
|
|
|
onMounted(() => {
|
|
if (!props.block.note) return;
|
|
|
|
os.magApi(
|
|
endpoints.GetNoteById,
|
|
{ context: props.block.detailed, attachments: true },
|
|
{ id: props.block.note }
|
|
).then((result) => {
|
|
note.value = result;
|
|
});
|
|
});
|
|
|
|
return {
|
|
note,
|
|
};
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.voxdxuby {
|
|
margin: 1em 0;
|
|
}
|
|
</style>
|