From f0acc006e74145024c2b1724b7df95dfbf54dc43 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Thu, 6 Jan 2022 17:32:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dnodata=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/tools.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/utils/tools.js b/src/utils/tools.js index eabb543d..bce51184 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -358,16 +358,24 @@ export const noData = { if (el) { if (binding.value) { setTimeout(() => { + // 是否已有no data + let alreadyHasNoData = false el.childNodes.forEach(node => { - node.style && (node.style.display = 'none') + if (node.classList && node.classList.value.indexOf('no-data') > -1) { + alreadyHasNoData = true + } else { + node.style && (node.style.display = 'none') + } }) - el.insertBefore(noDataDomFactory(), el.childNodes[0]) + if (!alreadyHasNoData) { + el.insertBefore(noDataDomFactory(), el.childNodes[0]) + } }) } else { setTimeout(() => { for (let i = 0; i < el.childNodes.length; i++) { const node = el.childNodes[i] - if (node.innerText === 'No data') { + if (node.classList && node.classList.value.indexOf('no-data') > -1) { el.removeChild(node) break }