Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-monitor
Project
Project
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
Administrator
web-monitor
Commits
dcd3e316
Commit
dcd3e316
authored
Nov 24, 2017
by
Pan
Committed by
花裤衩
Nov 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:refine SvgIcon
parent
e431fa97
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
37 deletions
+48
-37
index.vue
src/components/Icon-svg/index.vue
+0
-22
index.vue
src/components/SvgIcon/index.vue
+42
-0
index.js
src/icons/index.js
+2
-2
index.scss
src/styles/index.scss
+0
-9
SidebarItem.vue
src/views/layout/components/Sidebar/SidebarItem.vue
+2
-2
index.vue
src/views/login/index.vue
+2
-2
No files found.
src/components/Icon-svg/index.vue
deleted
100644 → 0
View file @
e431fa97
<
template
>
<svg
class=
"svg-icon"
aria-hidden=
"true"
>
<use
:xlink:href=
"iconName"
></use>
</svg>
</
template
>
<
script
>
export
default
{
name
:
'icon-svg'
,
props
:
{
iconClass
:
{
type
:
String
,
required
:
true
}
},
computed
:
{
iconName
()
{
return
`#icon-
${
this
.
iconClass
}
`
}
}
}
</
script
>
src/components/SvgIcon/index.vue
0 → 100644
View file @
dcd3e316
<
template
>
<svg
:class=
"svgClass"
aria-hidden=
"true"
>
<use
:xlink:href=
"iconName"
></use>
</svg>
</
template
>
<
script
>
export
default
{
name
:
'svg-icon'
,
props
:
{
iconClass
:
{
type
:
String
,
required
:
true
},
className
:
{
type
:
String
}
},
computed
:
{
iconName
()
{
return
`#icon-
${
this
.
iconClass
}
`
},
svgClass
()
{
if
(
this
.
className
)
{
return
'svg-icon '
+
this
.
className
}
else
{
return
'svg-icon'
}
}
}
}
</
script
>
<
style
scoped
>
.svg-icon
{
width
:
1em
;
height
:
1em
;
vertical-align
:
-0.15em
;
fill
:
currentColor
;
overflow
:
hidden
;
}
</
style
>
src/icons/index.js
View file @
dcd3e316
import
Vue
from
'vue'
import
IconSvg
from
'@/components/Icon-svg
'
// svg组件
import
SvgIcon
from
'@/components/SvgIcon
'
// svg组件
// register globally
Vue
.
component
(
'
icon-svg'
,
IconSvg
)
Vue
.
component
(
'
svg-icon'
,
SvgIcon
)
const
requireAll
=
requireContext
=>
requireContext
.
keys
().
map
(
requireContext
)
const
req
=
require
.
context
(
'./svg'
,
false
,
/
\.
svg$/
)
...
...
src/styles/index.scss
View file @
dcd3e316
...
...
@@ -55,12 +55,3 @@ a:hover {
.app-container
{
padding
:
20px
;
}
.svg-icon
{
width
:
1em
;
height
:
1em
;
vertical-align
:
-0
.15em
;
fill
:
currentColor
;
overflow
:
hidden
;
}
src/views/layout/components/Sidebar/SidebarItem.vue
View file @
dcd3e316
...
...
@@ -3,12 +3,12 @@
<template
v-for=
"item in routes"
>
<router-link
v-if=
"!item.hidden&&item.noDropdown&&item.children.length>0"
:to=
"item.path+'/'+item.children[0].path"
>
<el-menu-item
:index=
"item.path+'/'+item.children[0].path"
>
<
icon-svg
v-if=
'item.icon'
:icon-class=
"item.icon"
/>
{{
item
.
children
[
0
].
name
}}
<
svg-icon
v-if=
'item.icon'
:icon-class=
"item.icon"
/>
{{
item
.
children
[
0
].
name
}}
</el-menu-item>
</router-link>
<el-submenu
:index=
"item.name"
v-if=
"!item.noDropdown&&!item.hidden"
>
<template
slot=
"title"
>
<
icon-svg
v-if=
'item.icon'
:icon-class=
"item.icon"
/>
{{
item
.
name
}}
<
svg-icon
v-if=
'item.icon'
:icon-class=
"item.icon"
/>
{{
item
.
name
}}
</
template
>
<
template
v-for=
"child in item.children"
v-if=
'!child.hidden'
>
<sidebar-item
class=
'menu-indent'
v-if=
'child.children&&child.children.length>0'
:routes=
'[child]'
>
</sidebar-item>
...
...
src/views/login/index.vue
View file @
dcd3e316
...
...
@@ -5,13 +5,13 @@
<h3
class=
"title"
>
vue-element-admin
</h3>
<el-form-item
prop=
"username"
>
<span
class=
"svg-container svg-container_login"
>
<
icon-svg
icon-class=
"yonghuming"
/>
<
svg-icon
icon-class=
"yonghuming"
/>
</span>
<el-input
name=
"username"
type=
"text"
v-model=
"loginForm.username"
autoComplete=
"on"
placeholder=
"username"
/>
</el-form-item>
<el-form-item
prop=
"password"
>
<span
class=
"svg-container"
>
<
icon-svg
icon-class=
"mima"
></icon-svg
>
<
svg-icon
icon-class=
"mima"
></svg-icon
>
</span>
<el-input
name=
"password"
type=
"password"
@
keyup
.
enter
.
native=
"handleLogin"
v-model=
"loginForm.password"
autoComplete=
"on"
placeholder=
"password"
></el-input>
...
...
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