Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d758f602
authored
2022-08-12 11:16:29 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:换肤效果
1 parent
d023487e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
3 deletions
src/directive/theme.js
src/layout/components/Navbar.vue
src/main.js
src/utils/mixin/theme.js
src/directive/theme.js
0 → 100644
View file @
d758f60
export
const
theme
=
{
bind
:
function
(
el
,
binding
,
vnode
)
{
setEleStyleColorAttribute
(
el
,
binding
);
},
update
:
function
(
el
,
binding
,
vnode
)
{
setEleStyleColorAttribute
(
el
,
binding
);
},
componentUpdated
:
function
(
el
,
binding
,
vnode
)
{
setEleStyleColorAttribute
(
el
,
binding
);
}
}
function
setEleStyleColorAttribute
(
el
,
binding
)
{
const
{
name
,
value
,
arg
,
expression
,
modifiers
}
=
binding
;
const
{
background
,
font
,
border
}
=
modifiers
;
if
(
background
)
el
.
style
[
'background-color'
]
=
value
;
if
(
font
)
el
.
style
.
color
=
value
;
if
(
border
)
el
.
style
[
'border-color'
]
=
value
;
}
\ No newline at end of file
src/layout/components/Navbar.vue
View file @
d758f60
<
template
>
<div
class=
"navbar"
>
<div
class=
"navbar"
v-theme
.
background=
"mTheme"
>
<div
class=
"logo"
>
<img
v-if=
"logo"
:src=
"logo"
class=
"header-logo"
>
</div>
...
...
@@ -94,7 +94,7 @@ export default {
overflow
:
hidden
;
position
:
relative
;
background
:
#fff
;
background
:
linear-gradient
(
270deg
,
#148CEE
0%
,
#1870E3
100%
);
//
background
:
linear-gradient
(
270deg
,
#148CEE
0%
,
#1870E3
100%
);
//默认颜色
box-shadow
:
0
1px
0px
rgba
(
0
,
21
,
41
,
0.08
);
display
:
flex
;
align-items
:
center
;
...
...
src/main.js
View file @
d758f60
...
...
@@ -6,7 +6,12 @@ import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import
Element
from
'element-ui'
import
'./styles/element-variables.scss'
import
'@/styles/index.scss'
import
Base
from
'./components/Base/base'
import
Base
from
'./components/Base/base'
// 全局组件引入
import
mixin
from
'@/utils/mixin/theme.js'
Vue
.
mixin
(
mixin
);
import
{
theme
}
from
"@/directive/theme.js"
Vue
.
directive
(
"theme"
,
theme
)
import
'./image/icons'
// icon
import
store
from
'./store'
...
...
src/utils/mixin/theme.js
0 → 100644
View file @
d758f60
export
default
{
name
:
'mixin'
,
computed
:
{
mTheme
()
{
return
this
.
$store
.
state
.
app
.
theme
;
}
}
}
\ No newline at end of file
Please
register
or
sign in
to post a comment