fix: 开场白不支持Markdown表格语法,无法显示一个表格。 #496 (#511)
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
shaohuzhang1 2024-05-22 19:14:08 +08:00 committed by GitHub
parent ca9cb9e355
commit d9e171c430
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -234,22 +234,35 @@ const prologueList = computed(() => {
const temp = props.available const temp = props.available
? props.data?.prologue ? props.data?.prologue
: '抱歉,当前正在维护,无法提供服务,请稍后再试!' : '抱歉,当前正在维护,无法提供服务,请稍后再试!'
let arr: any = []
const lines = temp?.split('\n') const lines = temp?.split('\n')
lines?.forEach((str: string, index: number) => { return lines
if (isMdArray(str)) { .reduce((pre_array: Array<any>, current: string, index: number) => {
arr[index] = { const currentObj = isMdArray(current)
type: 'question', ? {
str: str.replace(/^-\s+/, '') type: 'question',
str: current.replace(/^-\s+/, ''),
index: index
}
: {
type: 'md',
str: current,
index: index
}
if (pre_array.length > 0) {
const pre = pre_array[pre_array.length - 1]
if (!isMdArray(current) && pre.type == 'md') {
pre.str = [pre.str, current].join('\n')
pre.index = index
return pre_array
} else {
pre_array.push(currentObj)
}
} else {
pre_array.push(currentObj)
} }
} else { return pre_array
arr[index] = { }, [])
type: 'md', .sort((pre: any, next: any) => pre.index - next.index)
str
}
}
})
return arr
}) })
watch( watch(