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
| <template>
| <i :class="classes" :style="styles" @click="handleClick"></i>
| </template>
| <script>
| const prefixCls = 'ivu-icon';
|
| export default {
| name: 'Icon',
| props: {
| type: {
| type: String,
| default: ''
| },
| size: [Number, String],
| color: String,
| custom: {
| type: String,
| default: ''
| }
| },
| computed: {
| classes () {
| return [
| `${prefixCls}`,
| {
| [`${prefixCls}-${this.type}`]: this.type !== '',
| [`${this.custom}`]: this.custom !== '',
| }
| ];
| },
| styles () {
| let style = {};
|
| if (this.size) {
| style['font-size'] = `${this.size}px`;
| }
|
| if (this.color) {
| style.color = this.color;
| }
|
| return style;
| }
| },
| methods: {
| handleClick (event) {
| this.$emit('click', event);
| }
| }
| };
| </script>
|
|