File tree Expand file tree Collapse file tree 6 files changed +48
-37
lines changed Expand file tree Collapse file tree 6 files changed +48
-37
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <svg :class =" svgClass" aria-hidden =" true" >
3
+ <use :xlink:href =" iconName" ></use >
4
+ </svg >
5
+ </template >
6
+
7
+ <script >
8
+ export default {
9
+ name: ' svg-icon' ,
10
+ props: {
11
+ iconClass: {
12
+ type: String ,
13
+ required: true
14
+ },
15
+ className: {
16
+ type: String
17
+ }
18
+ },
19
+ computed: {
20
+ iconName () {
21
+ return ` #icon-${ this .iconClass } `
22
+ },
23
+ svgClass () {
24
+ if (this .className ) {
25
+ return ' svg-icon ' + this .className
26
+ } else {
27
+ return ' svg-icon'
28
+ }
29
+ }
30
+ }
31
+ }
32
+ </script >
33
+
34
+ <style scoped>
35
+ .svg-icon {
36
+ width : 1em ;
37
+ height : 1em ;
38
+ vertical-align : -0.15em ;
39
+ fill : currentColor ;
40
+ overflow : hidden ;
41
+ }
42
+ </style >
Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
- import IconSvg from '@/components/Icon-svg ' // svg组件
2
+ import SvgIcon from '@/components/SvgIcon ' // svg组件
3
3
4
4
// register globally
5
- Vue . component ( 'icon- svg' , IconSvg )
5
+ Vue . component ( 'svg-icon ' , SvgIcon )
6
6
7
7
const requireAll = requireContext => requireContext . keys ( ) . map ( requireContext )
8
8
const req = require . context ( './svg' , false , / \. s v g $ / )
Original file line number Diff line number Diff line change @@ -55,12 +55,3 @@ a:hover {
55
55
.app-container {
56
56
padding : 20px ;
57
57
}
58
-
59
- .svg-icon {
60
- width : 1em ;
61
- height : 1em ;
62
- vertical-align : -0.15em ;
63
- fill : currentColor ;
64
- overflow : hidden ;
65
- }
66
-
Original file line number Diff line number Diff line change 3
3
<template v-for =" item in routes " >
4
4
<router-link v-if =" !item.hidden&&item.noDropdown&&item.children.length>0" :to =" item.path+'/'+item.children[0].path" >
5
5
<el-menu-item :index =" item.path+'/'+item.children[0].path" >
6
- <icon- svg v-if =' item.icon' :icon-class =" item.icon" /> {{item.children[0].name}}
6
+ <svg-icon v-if =' item.icon' :icon-class =" item.icon" /> {{item.children[0].name}}
7
7
</el-menu-item >
8
8
</router-link >
9
9
<el-submenu :index =" item.name" v-if =" !item.noDropdown&& !item.hidden" >
10
10
<template slot="title">
11
- <icon- svg v-if =' item.icon' :icon-class =" item.icon" /> {{item.name}}
11
+ <svg-icon v-if =' item.icon' :icon-class =" item.icon" /> {{item.name}}
12
12
</template >
13
13
<template v-for =" child in item .children " v-if =' ! child .hidden ' >
14
14
<sidebar-item class =' menu-indent' v-if =' child.children&&child.children.length>0' :routes =' [child]' > </sidebar-item >
Original file line number Diff line number Diff line change 5
5
<h3 class =" title" >vue-element-admin</h3 >
6
6
<el-form-item prop =" username" >
7
7
<span class =" svg-container svg-container_login" >
8
- <icon- svg icon-class =" yonghuming" />
8
+ <svg-icon icon-class =" yonghuming" />
9
9
</span >
10
10
<el-input name =" username" type =" text" v-model =" loginForm.username" autoComplete =" on" placeholder =" username" />
11
11
</el-form-item >
12
12
<el-form-item prop =" password" >
13
13
<span class =" svg-container" >
14
- <icon- svg icon-class =" mima" ></icon- svg >
14
+ <svg-icon icon-class =" mima" ></svg-icon >
15
15
</span >
16
16
<el-input name =" password" type =" password" @keyup.enter.native =" handleLogin" v-model =" loginForm.password" autoComplete =" on"
17
17
placeholder =" password" ></el-input >
You can’t perform that action at this time.
0 commit comments