misskey/src/client/components/page/page.note.vue

48 lines
996 B
Vue
Raw Normal View History

2020-11-15 13:42:04 +09:00
<template>
<div class="voxdxuby">
<XNote v-if="note && !block.detailed" v-model:note="note" :key="note.id + ':normal'"/>
<XNoteDetailed v-if="note && block.detailed" v-model:note="note" :key="note.id + ':detail'"/>
2020-11-15 13:42:04 +09:00
</div>
</template>
<script lang="ts">
import { defineComponent, onMounted, PropType, Ref, ref } from 'vue';
2020-11-15 13:42:04 +09:00
import XNote from '@/components/note.vue';
import XNoteDetailed from '@/components/note-detailed.vue';
2020-11-15 13:42:04 +09:00
import * as os from '@/os';
import { NoteBlock } from '@/scripts/hpml/block';
2020-11-15 13:42:04 +09:00
export default defineComponent({
components: {
XNote,
XNoteDetailed,
2020-11-15 13:42:04 +09:00
},
props: {
block: {
type: Object as PropType<NoteBlock>,
2020-11-15 13:42:04 +09:00
required: true
}
},
setup(props, ctx) {
const note: Ref<Record<string, any> | null> = ref(null);
onMounted(() => {
os.api('notes/show', { noteId: props.block.note })
.then(result => {
note.value = result;
});
});
2020-11-15 13:42:04 +09:00
return {
note
2020-11-15 13:42:04 +09:00
};
}
});
</script>
<style lang="scss" scoped>
.voxdxuby {
margin: 1em 0;
}
</style>