fix: 修复loading样式错误、nodata没有正常显示的问题

This commit is contained in:
chenjinsong
2021-12-27 17:10:11 +08:00
parent dbf17b004b
commit 43b8ad7016
3 changed files with 56 additions and 49 deletions

View File

@@ -346,18 +346,24 @@ export const clickOutside = {
}
}
const noDataDom = document.createElement('div')
noDataDom.setAttribute('class', 'no-data')
noDataDom.innerText = 'No data'
function noDataDomFactory () {
const noDataDom = document.createElement('div')
noDataDom.setAttribute('class', 'no-data')
noDataDom.innerText = 'No data'
return noDataDom
}
export const noData = {
updated (el, binding) {
if (el && binding.oldValue !== binding.value) {
if (el) {
console.info(binding.value, el)
if (binding.value) {
setTimeout(() => {
el.childNodes.forEach(node => {
console.info(node, node.style)
node.style && (node.style.display = 'none')
})
el.insertBefore(noDataDom, el.childNodes[0])
el.insertBefore(noDataDomFactory(), el.childNodes[0])
})
} else {
setTimeout(() => {