Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7c325ee9
authored
Mar 03, 2023
by
bimei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 主题切换XTable颜色修改
parent
21e20021
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
src/components/XTable/src/XTable.vue
+28
-2
No files found.
src/components/XTable/src/XTable.vue
View file @
7c325ee9
...
...
@@ -12,6 +12,7 @@ import { useAppStore } from '@/store/modules/app'
import
{
useDesign
}
from
'@/hooks/web/useDesign'
import
{
XTableProps
}
from
'./type'
import
{
isBoolean
,
isFunction
}
from
'@/utils/is'
import
styleCss
from
'./style/dark.scss'
import
download
from
'@/utils/download'
...
...
@@ -26,14 +27,39 @@ const prefixCls = getPrefixCls('x-vxe-table')
const
attrs
=
useAttrs
()
const
emit
=
defineEmits
([
'register'
])
const
removeStyles
=
()
=>
{
var
filename
=
'cssTheme'
//移除引入的文件名
var
targetelement
=
'style'
var
targetattr
=
'id'
var
allsuspects
=
document
.
getElementsByTagName
(
targetelement
)
for
(
var
i
=
allsuspects
.
length
;
i
>=
0
;
i
--
)
{
if
(
allsuspects
[
i
]
&&
allsuspects
[
i
].
getAttribute
(
targetattr
)
!=
null
&&
allsuspects
[
i
].
getAttribute
(
targetattr
)?.
indexOf
(
filename
)
!=
-
1
)
{
console
.
log
(
allsuspects
[
i
],
'node'
)
allsuspects
[
i
].
parentNode
?.
removeChild
(
allsuspects
[
i
])
}
}
}
const
reImport
=
()
=>
{
var
head
=
document
.
getElementsByTagName
(
'head'
)[
0
]
var
style
=
document
.
createElement
(
'style'
)
style
.
innerText
=
styleCss
style
.
id
=
'cssTheme'
head
.
appendChild
(
style
)
}
watch
(
()
=>
appStore
.
getIsDark
,
()
=>
{
if
(
appStore
.
getIsDark
==
true
)
{
import
(
'./style/dark.scss'
)
reImport
(
)
}
if
(
appStore
.
getIsDark
==
false
)
{
import
(
'./style/light.scss'
)
removeStyles
(
)
}
},
{
immediate
:
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment