Fancy transitions!
This commit is contained in:
parent
472ab354d8
commit
5f9eb1fc50
11 changed files with 183 additions and 107 deletions
35
components/Markdown.vue
Normal file
35
components/Markdown.vue
Normal file
|
@ -0,0 +1,35 @@
|
|||
<script setup lang="ts">
|
||||
import configured_markdown from '~/assets/markdown_conf';
|
||||
import { useSlots } from 'vue';
|
||||
|
||||
let markdown = configured_markdown();
|
||||
|
||||
const text = ref("");
|
||||
const loading = ref(true);
|
||||
|
||||
const props = defineProps({
|
||||
text: String,
|
||||
});
|
||||
|
||||
function render_markdown(data: string | undefined) {
|
||||
if (!data) {
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
text.value = markdown.render(data);
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
watch(() => props.text, (newVal) => {
|
||||
render_markdown(newVal);
|
||||
}, {
|
||||
immediate: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="loading" class="text-center animate-pulse">
|
||||
<h2>Loading...</h2>
|
||||
</div>
|
||||
<div v-html="text"></div>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue