mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-09 08:52:41 +08:00
fix: 解决流程图预览,控制台v-highlight过多告警问题
This commit is contained in:
parent
903428d063
commit
78e658389b
@ -188,12 +188,8 @@
|
|||||||
:scroll="true"
|
:scroll="true"
|
||||||
max-height="600px"
|
max-height="600px"
|
||||||
>
|
>
|
||||||
<!-- append-to-body -->
|
<div>
|
||||||
<div v-highlight>
|
<pre><code v-dompurify-html="highlightedCode(previewResult)" class="hljs"></code></pre>
|
||||||
<code class="hljs">
|
|
||||||
<!-- 高亮代码块 -->
|
|
||||||
{{ previewResult }}
|
|
||||||
</code>
|
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
@ -237,6 +233,8 @@ import { XmlNode, XmlNodeType, parseXmlString } from 'steady-xml'
|
|||||||
// const eventName = reactive({
|
// const eventName = reactive({
|
||||||
// name: ''
|
// name: ''
|
||||||
// })
|
// })
|
||||||
|
import hljs from 'highlight.js' // 导入代码高亮文件
|
||||||
|
import 'highlight.js/styles/github.css' // 导入代码高亮样式
|
||||||
|
|
||||||
defineOptions({ name: 'MyProcessDesigner' })
|
defineOptions({ name: 'MyProcessDesigner' })
|
||||||
|
|
||||||
@ -308,6 +306,18 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码高亮
|
||||||
|
*/
|
||||||
|
const highlightedCode = (code: string) => {
|
||||||
|
// 高亮
|
||||||
|
if (previewType.value === 'json') {
|
||||||
|
code = JSON.stringify(code, null, 2)
|
||||||
|
}
|
||||||
|
const result = hljs.highlight(code, { language: previewType.value, ignoreIllegals: true })
|
||||||
|
return result.value || ' '
|
||||||
|
}
|
||||||
|
|
||||||
provide('configGlobal', props)
|
provide('configGlobal', props)
|
||||||
let bpmnModeler: any = null
|
let bpmnModeler: any = null
|
||||||
const defaultZoom = ref(1)
|
const defaultZoom = ref(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user