Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tianzhuanghu
ant-design-pro-vue
Commits
fcc805c8
Commit
fcc805c8
authored
Oct 20, 2018
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update defaultConfig
parent
7d19bc36
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
43 deletions
+64
-43
SettingDrawer.vue
src/components/tools/SettingDrawer.vue
+47
-27
defaultConfig.js
src/defaultConfig.js
+10
-6
main.js
src/main.js
+6
-9
index.js
src/router/index.js
+1
-1
No files found.
src/components/tools/SettingDrawer.vue
View file @
fcc805c8
...
...
@@ -14,36 +14,56 @@
<h3
class=
"setting-drawer-index-title"
>
整体风格设置
</h3>
<div
class=
"setting-drawer-index-blockChecbox"
>
<div
class=
"setting-drawer-index-item"
@
click=
"changeMenuTheme('dark')"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg"
alt=
"dark"
>
<div
class=
"setting-drawer-index-selectIcon"
v-if=
"theme === 'dark'"
>
<a-icon
type=
"check"
/>
<a-tooltip>
<template
slot=
"title"
>
暗色菜单风格
</
template
>
<div
class=
"setting-drawer-index-item"
@
click=
"changeMenuTheme('dark')"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg"
alt=
"dark"
>
<div
class=
"setting-drawer-index-selectIcon"
v-if=
"navTheme === 'dark'"
>
<a-icon
type=
"check"
/>
</div>
</div>
</div>
<div
class=
"setting-drawer-index-item"
@
click=
"changeMenuTheme('light')"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg"
alt=
"light"
>
<div
class=
"setting-drawer-index-selectIcon"
v-if=
"theme !== 'dark'"
>
<a-icon
type=
"check"
/>
</a-tooltip>
<a-tooltip>
<
template
slot=
"title"
>
亮色菜单风格
</
template
>
<div
class=
"setting-drawer-index-item"
@
click=
"changeMenuTheme('light')"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg"
alt=
"light"
>
<div
class=
"setting-drawer-index-selectIcon"
v-if=
"navTheme !== 'dark'"
>
<a-icon
type=
"check"
/>
</div>
</div>
</
div
>
</
a-tooltip
>
</div>
</div>
<div
:style=
"{ marginBottom: '24px' }"
>
<h3
class=
"setting-drawer-index-title"
>
主题色
</h3>
<div>
<div
style=
"height: 20px"
>
<a-tooltip
class=
"setting-drawer-theme-color-colorBlock"
v-for=
"(item, index) in colorList"
:key=
"index"
>
<
template
slot=
'title'
>
{{
item
.
key
}}
</
template
>
<a-tag
:color=
"item.color"
@
click=
"changeColor(item)"
>
<a-icon
type=
"check"
v-if=
"item.color ===
colorObj.c
olor"
></a-icon>
<a-tag
:color=
"item.color"
@
click=
"changeColor(item
.color
)"
>
<a-icon
type=
"check"
v-if=
"item.color ===
primaryC
olor"
></a-icon>
</a-tag>
</a-tooltip>
</div>
</div>
<a-divider
/>
<div
:style=
"{ marginBottom: '24px' }"
>
<a-alert
type=
"warning"
>
<span
slot=
"message"
>
配置栏只在开发环境用于预览,生产环境不会展现,请手动修改配置文件
<a
href=
"https://github.com/sendya/ant-design-pro-vue/blob/master/src/defaultConfig.js"
target=
"_blank"
>
src/defaultConfig.js
</a>
</span>
</a-alert>
</div>
</div>
<div
class=
"setting-drawer-index-handle"
@
click=
"toggle"
>
<a-icon
type=
"setting"
v-if=
"!visible"
/>
...
...
@@ -62,35 +82,35 @@
const
colorList
=
[
{
key
:
'
dust
'
,
key
:
'
薄暮
'
,
color
:
'#F5222D'
,
},
{
key
:
'
volcano
'
,
key
:
'
火山
'
,
color
:
'#FA541C'
,
},
{
key
:
'
sunset
'
,
key
:
'
日暮
'
,
color
:
'#FAAD14'
,
},
{
key
:
'
cyan
'
,
key
:
'
明青
'
,
color
:
'#13C2C2'
,
},
{
key
:
'
green
'
,
key
:
'
极光绿
'
,
color
:
'#52C41A'
,
},
{
key
:
'
daybreak
'
,
key
:
'
拂晓蓝(默认)
'
,
color
:
'#1890FF'
,
},
{
key
:
'
geekblue
'
,
key
:
'
极客蓝
'
,
color
:
'#2F54EB'
,
},
{
key
:
'
purple
'
,
key
:
'
酱紫
'
,
color
:
'#722ED1'
,
},
];
...
...
@@ -107,8 +127,8 @@
},
computed
:
{
...
mapState
({
t
heme
:
state
=>
state
.
app
.
theme
,
colorObj
:
state
=>
state
.
app
.
color
,
navT
heme
:
state
=>
state
.
app
.
theme
,
primaryColor
:
state
=>
state
.
app
.
color
,
})
},
mounted
()
{
...
...
@@ -117,8 +137,8 @@
vm
.
visible
=
false
},
1
)
// 当主题色不是默认色时,才进行主题编译
if
(
this
.
colorObj
.
color
!==
config
.
color
.
c
olor
)
{
updateTheme
(
this
.
colorObj
.
c
olor
)
if
(
this
.
primaryColor
!==
config
.
primaryC
olor
)
{
updateTheme
(
this
.
primaryC
olor
)
}
},
methods
:
{
...
...
@@ -135,9 +155,9 @@
this
.
$store
.
dispatch
(
'ToggleTheme'
,
theme
)
},
changeColor
(
color
)
{
if
(
this
.
colorObj
.
color
!==
color
.
color
)
{
if
(
this
.
primaryColor
!==
color
)
{
this
.
$store
.
dispatch
(
'ToggleColor'
,
color
)
updateTheme
(
color
.
color
)
updateTheme
(
color
)
}
}
},
...
...
src/defaultConfig.js
View file @
fcc805c8
export
default
{
color
:
{
key
:
'daybreak'
,
color
:
'#1890FF'
},
theme
:
'dark'
,
colorWeak
:
false
primaryColor
:
'#1890FF'
,
// primary color of ant design
navTheme
:
'dark'
,
// theme for nav menu
colorWeak
:
false
,
// vue-ls options
storageOptions
:
{
namespace
:
'pro__'
,
// key prefix
name
:
'ls'
,
// name variable Vue.[ls] or this.[$ls],
storage
:
'local'
,
// storage name session, local, memory
}
}
\ No newline at end of file
src/main.js
View file @
fcc805c8
...
...
@@ -21,15 +21,13 @@ Vue.filter('dayjs', function(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
return
dayjs
(
dataStr
).
format
(
pattern
)
})
const
options
=
{
namespace
:
'ant__'
,
// key prefix
name
:
'ls'
,
// name variable Vue.[ls] or this.[$ls],
storage
:
'local'
,
// storage name session, local, memory
}
Vue
.
filter
(
'moment'
,
function
(
dataStr
,
pattern
=
'YYYY-MM-DD HH:mm:ss'
)
{
return
dayjs
(
dataStr
).
format
(
pattern
)
})
Vue
.
config
.
productionTip
=
false
Vue
.
use
(
Storage
,
o
ptions
)
Vue
.
use
(
Storage
,
config
.
storageO
ptions
)
Vue
.
use
(
Antd
)
Vue
.
use
(
VueAxios
,
router
)
Vue
.
use
(
Viser
)
...
...
@@ -39,10 +37,9 @@ new Vue({
store
,
mounted
()
{
store
.
commit
(
'SET_SIDEBAR_TYPE'
,
Vue
.
ls
.
get
(
SIDEBAR_TYPE
,
false
))
store
.
commit
(
'TOGGLE_THEME'
,
Vue
.
ls
.
get
(
DEFAULT_THEME
,
config
.
t
heme
))
store
.
commit
(
'TOGGLE_COLOR'
,
Vue
.
ls
.
get
(
DEFAULT_COLOR
,
config
.
c
olor
))
store
.
commit
(
'TOGGLE_THEME'
,
Vue
.
ls
.
get
(
DEFAULT_THEME
,
config
.
navT
heme
))
store
.
commit
(
'TOGGLE_COLOR'
,
Vue
.
ls
.
get
(
DEFAULT_COLOR
,
config
.
primaryC
olor
))
store
.
commit
(
'SET_TOKEN'
,
Vue
.
ls
.
get
(
ACCESS_TOKEN
))
},
render
:
h
=>
h
(
App
)
}).
$mount
(
'#app'
)
src/router/index.js
View file @
fcc805c8
...
...
@@ -34,7 +34,7 @@ export const constantRouterMap = [
path
:
'/'
,
component
:
Layout
,
redirect
:
'/login'
,
name
:
'
首页
'
,
name
:
'
home
'
,
hidden
:
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