提交 4f474504 编写于 作者: View Design's avatar View Design

Update ProsePre.global.vue

上级 62e14af6
......@@ -9,7 +9,7 @@
/>
</pre>
<UDivider :ui="{ border: { base: 'border-gray-700' } }" />
<pre :class="$props.class" class="m-0 rounded-tl-none rounded-tr-none"><code ref="codeBlock">{{ code }}</code></pre>
<pre :class="$props.class" class="m-0 rounded-tl-none rounded-tr-none"><code v-html="codeBlock"></code></pre>
</template>
<script setup>
......@@ -55,9 +55,9 @@ const handleCopy = () => {
}
const codeBlock = ref(null)
const handleRender = () => {
if (codeBlock.value) {
codeBlock.value.textContent = props.code
hljs.highlightElement(codeBlock.value)
if (props.language) {
const lang = props.language === 'vue' ? 'html' : props.language
codeBlock.value = hljs.highlight(lang, props.code, true).value
}
}
watch(()=> props.code, () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册