Commit 3d1f3cf661981e8adae42250ebef78889bb78180
1 parent
77376451
close #3402
Showing
2 changed files
with
14 additions
and
4 deletions
Show diff stats
examples/routers/button.vue
... | ... | @@ -15,7 +15,6 @@ |
15 | 15 | line-height: 1; |
16 | 16 | -webkit-font-smoothing: antialiased; |
17 | 17 | -moz-osx-font-smoothing: grayscale; |
18 | - vertical-align: middle; | |
19 | 18 | } |
20 | 19 | .i-icon-accessory:before { content: "\e6dd"; } |
21 | 20 | |
... | ... | @@ -297,6 +296,10 @@ |
297 | 296 | <Icon custom="i-icon i-icon-video" size="24" color="#ff6600" /> |
298 | 297 | <Icon custom="i-icon i-icon-time" /> |
299 | 298 | <Icon type="ionic" /> |
299 | + <Button icon="ionic">Default</Button> | |
300 | + <Button custom-icon="i-icon i-icon-search">Default</Button> | |
301 | + <Button icon="ionic" shape="circle"></Button> | |
302 | + <Button custom-icon="i-icon i-icon-video" shape="circle"></Button> | |
300 | 303 | <hr> |
301 | 304 | <Button>Default</Button> |
302 | 305 | <Button type="primary">Primary</Button> | ... | ... |
src/components/button/button.vue
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | :disabled="disabled" |
6 | 6 | @click="handleClick"> |
7 | 7 | <Icon class="ivu-load-loop" type="load-c" v-if="loading"></Icon> |
8 | - <Icon :type="icon" v-if="icon && !loading"></Icon> | |
8 | + <Icon :type="icon" :custom="customIcon" v-if="(icon || customIcon) && !loading"></Icon> | |
9 | 9 | <span v-if="showSlot" ref="slot"><slot></slot></span> |
10 | 10 | </button> |
11 | 11 | </template> |
... | ... | @@ -42,7 +42,14 @@ |
42 | 42 | return oneOf(value, ['button', 'submit', 'reset']); |
43 | 43 | } |
44 | 44 | }, |
45 | - icon: String, | |
45 | + icon: { | |
46 | + type: String, | |
47 | + default: '' | |
48 | + }, | |
49 | + customIcon: { | |
50 | + type: String, | |
51 | + default: '' | |
52 | + }, | |
46 | 53 | long: { |
47 | 54 | type: Boolean, |
48 | 55 | default: false |
... | ... | @@ -63,7 +70,7 @@ |
63 | 70 | [`${prefixCls}-${this.shape}`]: !!this.shape, |
64 | 71 | [`${prefixCls}-${this.size}`]: !!this.size, |
65 | 72 | [`${prefixCls}-loading`]: this.loading != null && this.loading, |
66 | - [`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading) | |
73 | + [`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || !!this.customIcon || this.loading) | |
67 | 74 | } |
68 | 75 | ]; |
69 | 76 | } | ... | ... |