hippofish/packages/client/src/components/page/page.note.vue

57 lines
1 KiB
Vue
Raw Normal View History

2020-11-15 05:42:04 +01:00
<template>
2023-04-08 02:01:42 +02:00
<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>
2020-11-15 05:42:04 +01:00
</template>
<script lang="ts">
2023-04-08 02:01:42 +02:00
import { defineComponent, onMounted, PropType, Ref, ref } from "vue";
import XNote from "@/components/MkNote.vue";
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
import * as os from "@/os";
import { NoteBlock } from "@/scripts/hpml/block";
2020-11-15 05:42:04 +01:00
export default defineComponent({
components: {
XNote,
XNoteDetailed,
2020-11-15 05:42:04 +01:00
},
props: {
block: {
type: Object as PropType<NoteBlock>,
2023-04-08 02:01:42 +02:00
required: true,
},
2020-11-15 05:42:04 +01:00
},
setup(props, ctx) {
const note: Ref<Record<string, any> | null> = ref(null);
onMounted(() => {
2023-04-08 02:01:42 +02:00
os.api("notes/show", { noteId: props.block.note }).then(
(result) => {
note.value = result;
2023-07-06 03:28:27 +02:00
},
2023-04-08 02:01:42 +02:00
);
});
2020-11-15 05:42:04 +01:00
return {
2023-04-08 02:01:42 +02:00
note,
2020-11-15 05:42:04 +01:00
};
2023-04-08 02:01:42 +02:00
},
2020-11-15 05:42:04 +01:00
});
</script>
<style lang="scss" scoped>
.voxdxuby {
margin: 1em 0;
}
</style>