mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
parent
ca9cb9e355
commit
d9e171c430
|
|
@ -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(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue