-
Notifications
You must be signed in to change notification settings - Fork 9
/
u-icon.vue
62 lines (55 loc) · 1.16 KB
/
u-icon.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
<a
:class="'u-icon-' + name"
class="u-icon material-icons"
:style="style"
:size="size"
v-on="listeners"
@click="onClick"
:href="href"
:disabled="disabled"
>
{{ name }}
</a>
</template>
<script>
import ULink from './u-link'
export default {
name: 'u-icon',
mixins: [ULink],
props: {
name: { type: String, required: true },
color: { type: String },
size: { type: String }
},
computed: {
style() {
let style = {}
if (this.color) {
style.color = this.color
}
if (this.size && !['s', 'l'].includes(this.size)) {
style.fontSize = this.size
}
return style
}
}
}
</script>
<style lang="scss">
@import '~material-design-icons/iconfont/material-icons.css';
.u-icon {
cursor: pointer;
font-size: 18px;
vertical-align: text-bottom; /* align icon and text*/
&[size='s'] {
font-size: 14px;
}
&[size='l'] {
font-size: 24px;
}
&[disabled] {
cursor: not-allowed;
}
}
</style>