From 84e802fe93d868e09ff6575b220f0dcfc7dfab11 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Mon, 6 Mar 2023 11:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8const=20let=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=8E=89var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/XTable/src/XTable.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/XTable/src/XTable.vue b/src/components/XTable/src/XTable.vue index e5c503ec..4ae546db 100644 --- a/src/components/XTable/src/XTable.vue +++ b/src/components/XTable/src/XTable.vue @@ -26,12 +26,12 @@ const prefixCls = getPrefixCls('x-vxe-table') const attrs = useAttrs() const emit = defineEmits(['register']) const removeStyles = () => { - var filename = 'cssTheme' + const filename = 'cssTheme' //移除引入的文件名 - var targetelement = 'style' - var targetattr = 'id' - var allsuspects = document.getElementsByTagName(targetelement) - for (var i = allsuspects.length; i >= 0; i--) { + const targetelement = 'style' + const targetattr = 'id' + const allsuspects = document.getElementsByTagName(targetelement) + for (let i = allsuspects.length; i >= 0; i--) { if ( allsuspects[i] && allsuspects[i].getAttribute(targetattr) != null && @@ -43,8 +43,8 @@ const removeStyles = () => { } } const reImport = () => { - var head = document.getElementsByTagName('head')[0] - var style = document.createElement('style') + const head = document.getElementsByTagName('head')[0] + const style = document.createElement('style') style.innerText = styleCss style.id = 'cssTheme' head.appendChild(style) @@ -52,10 +52,10 @@ const reImport = () => { watch( () => appStore.getIsDark, () => { - if (appStore.getIsDark == true) { + if (appStore.getIsDark) { reImport() } - if (appStore.getIsDark == false) { + if (!appStore.getIsDark) { removeStyles() } },