mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 16:32:43 +08:00
fix:表单构建页面,json显示和生成问题
This commit is contained in:
parent
e9950929de
commit
aba4705b8e
@ -135,7 +135,8 @@ const makeTemplate = () => {
|
|||||||
|
|
||||||
/** 复制 **/
|
/** 复制 **/
|
||||||
const copy = async (text: string) => {
|
const copy = async (text: string) => {
|
||||||
const { copy, copied, isSupported } = useClipboard({ source: text })
|
const textToCopy = JSON.stringify(text, null, 2)
|
||||||
|
const { copy, copied, isSupported } = useClipboard({ source: textToCopy })
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
message.error(t('common.copyError'))
|
message.error(t('common.copyError'))
|
||||||
} else {
|
} else {
|
||||||
@ -149,18 +150,19 @@ const copy = async (text: string) => {
|
|||||||
/**
|
/**
|
||||||
* 代码高亮
|
* 代码高亮
|
||||||
*/
|
*/
|
||||||
const highlightedCode = (code) => {
|
const highlightedCode = (code: string) => {
|
||||||
// 处理语言和代码
|
// 处理语言和代码
|
||||||
let language = 'json'
|
let language = 'json'
|
||||||
if (formType.value === 2) {
|
if (formType.value === 2) {
|
||||||
language = 'xml'
|
language = 'xml'
|
||||||
}
|
}
|
||||||
|
// debugger
|
||||||
if (!isString(code)) {
|
if (!isString(code)) {
|
||||||
code = JSON.stringify(code)
|
code = JSON.stringify(code, null, 2)
|
||||||
}
|
}
|
||||||
// 高亮
|
// 高亮
|
||||||
const result = hljs.highlight(language, code, true)
|
const result = hljs.highlight(code, { language: language, ignoreIllegals: true })
|
||||||
return result.value || ' '
|
return result.value
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user