Skip to content

Commit

Permalink
chg: ページ読み込み速度の改善
Browse files Browse the repository at this point in the history
  • Loading branch information
ashcolor committed Aug 12, 2024
1 parent 4a35278 commit 4eb0b63
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions components/content/ProsePre.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ const props = defineProps({
const isLoading = ref(true);
const codeHtml = ref("");
codeToHtml(props.code.replace(/\n$/, ""), {
lang: props.language,
theme: "github-dark",
}).then((html) => {
codeHtml.value = html;
const loadCode = async () => {
codeHtml.value = await codeToHtml(props.code.replace(/\n$/, ""), {
lang: props.language,
theme: "github-dark",
});
isLoading.value = false;
};
onMounted(async () => {
await loadCode();
});
</script>

Expand Down

0 comments on commit 4eb0b63

Please sign in to comment.