使用const let替换掉var
parent
0c34ce1962
commit
84e802fe93
|
@ -26,12 +26,12 @@ const prefixCls = getPrefixCls('x-vxe-table')
|
||||||
const attrs = useAttrs()
|
const attrs = useAttrs()
|
||||||
const emit = defineEmits(['register'])
|
const emit = defineEmits(['register'])
|
||||||
const removeStyles = () => {
|
const removeStyles = () => {
|
||||||
var filename = 'cssTheme'
|
const filename = 'cssTheme'
|
||||||
//移除引入的文件名
|
//移除引入的文件名
|
||||||
var targetelement = 'style'
|
const targetelement = 'style'
|
||||||
var targetattr = 'id'
|
const targetattr = 'id'
|
||||||
var allsuspects = document.getElementsByTagName(targetelement)
|
const allsuspects = document.getElementsByTagName(targetelement)
|
||||||
for (var i = allsuspects.length; i >= 0; i--) {
|
for (let i = allsuspects.length; i >= 0; i--) {
|
||||||
if (
|
if (
|
||||||
allsuspects[i] &&
|
allsuspects[i] &&
|
||||||
allsuspects[i].getAttribute(targetattr) != null &&
|
allsuspects[i].getAttribute(targetattr) != null &&
|
||||||
|
@ -43,8 +43,8 @@ const removeStyles = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const reImport = () => {
|
const reImport = () => {
|
||||||
var head = document.getElementsByTagName('head')[0]
|
const head = document.getElementsByTagName('head')[0]
|
||||||
var style = document.createElement('style')
|
const style = document.createElement('style')
|
||||||
style.innerText = styleCss
|
style.innerText = styleCss
|
||||||
style.id = 'cssTheme'
|
style.id = 'cssTheme'
|
||||||
head.appendChild(style)
|
head.appendChild(style)
|
||||||
|
@ -52,10 +52,10 @@ const reImport = () => {
|
||||||
watch(
|
watch(
|
||||||
() => appStore.getIsDark,
|
() => appStore.getIsDark,
|
||||||
() => {
|
() => {
|
||||||
if (appStore.getIsDark == true) {
|
if (appStore.getIsDark) {
|
||||||
reImport()
|
reImport()
|
||||||
}
|
}
|
||||||
if (appStore.getIsDark == false) {
|
if (!appStore.getIsDark) {
|
||||||
removeStyles()
|
removeStyles()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue