Skip to content

Commit

Permalink
main 🧊 optimize code component
Browse files Browse the repository at this point in the history
  • Loading branch information
debabin committed Jan 31, 2025
1 parent 7dbdf27 commit 2136b29
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions docs/src/components/code.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ const props = defineProps({
code: String,
lang: String
});
const container = ref(null);
onMounted(() => {
if (container.value) {
container.value.innerHTML += props.code;
}
});
</script>

<template>
<div ref="container" :class="`language-${props.lang} vp-adaptive-theme vp-code`">
<div :class="`language-${props.lang} vp-adaptive-theme vp-code`">
<button title="Copy code" class="copy" />
<span class="lang">{{ props.lang }}</span>
<div v-html="props.code" />
</div>
</template>

0 comments on commit 2136b29

Please sign in to comment.