fix: correction d'une regression sur le render

This commit is contained in:
Kazhnuz 2023-02-16 07:59:39 +01:00
parent 2ff9638f49
commit dafd9fe325

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUpdate } from "vue";
import { ref, onMounted, onBeforeUpdate, watch } from "vue";
import { marked } from "marked";
import { useTocStore } from "../../stores/toc";
@ -94,6 +94,10 @@ function render() {
}
}
function forceRender(markdown: string) {
htmlContent.value = marked.parse(markdown);
}
onMounted(() => {
render();
});
@ -101,6 +105,13 @@ onMounted(() => {
onBeforeUpdate(() => {
render();
});
watch(
() => props.markdown,
(newMd) => {
forceRender(newMd);
}
);
</script>
<template>