普通招生
This commit is contained in:
@@ -84,17 +84,40 @@ const checkCollapsibleContent = () => {
|
||||
}
|
||||
|
||||
// 否则,通过检查隐藏的检测元素是否有内容来判断
|
||||
// 需要等待 DOM 渲染完成
|
||||
// 需要等待 DOM 渲染完成,可能需要多次尝试以确保数据加载完成
|
||||
let retryCount = 0
|
||||
const maxRetries = 5
|
||||
|
||||
const check = () => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
if (detectionWrapperRef.value) {
|
||||
// 检查检测元素是否有子元素(排除文本节点)
|
||||
// 检查是否有 el-form-item 元素(因为表单项会被渲染为 el-form-item)
|
||||
const hasContent = detectionWrapperRef.value.children.length > 0 ||
|
||||
detectionWrapperRef.value.querySelector('.el-form-item') !== null ||
|
||||
(!!detectionWrapperRef.value.textContent && detectionWrapperRef.value.textContent.trim() !== '')
|
||||
|
||||
if (hasContent || retryCount >= maxRetries) {
|
||||
hasCollapsibleContent.value = hasContent
|
||||
} else {
|
||||
// 如果还没检测到内容且未达到最大重试次数,继续重试
|
||||
retryCount++
|
||||
setTimeout(check, 100)
|
||||
}
|
||||
} else {
|
||||
if (retryCount < maxRetries) {
|
||||
retryCount++
|
||||
setTimeout(check, 100)
|
||||
} else {
|
||||
hasCollapsibleContent.value = false
|
||||
}
|
||||
}
|
||||
}, 50)
|
||||
})
|
||||
}
|
||||
|
||||
check()
|
||||
}
|
||||
|
||||
// 是否有需要折叠的项
|
||||
|
||||
Reference in New Issue
Block a user