提交 3a9db0da 编写于 作者: D DebugIsFalse

fix: hljs 语言问题

上级 f350da6e
......@@ -91,9 +91,12 @@ const handleCopy = () => {
})
}
const codeBlock = ref(null)
const languages = hljs.listLanguages()
const BASE_LANG = 'html'
const handleRender = () => {
const language = props.language || 'html'
const lang = language.startsWith('vue') ? 'html' : language
const language = props.language || BASE_LANG
let lang = language.startsWith('vue') ? BASE_LANG : language
lang = languages.includes(lang) ? lang : BASE_LANG
codeBlock.value = hljs.highlight(props.code, { language: lang }).value
}
watch(()=> props.code, () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册