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,7 +15,6 @@ | ||
15 | line-height: 1; | 15 | line-height: 1; |
16 | -webkit-font-smoothing: antialiased; | 16 | -webkit-font-smoothing: antialiased; |
17 | -moz-osx-font-smoothing: grayscale; | 17 | -moz-osx-font-smoothing: grayscale; |
18 | - vertical-align: middle; | ||
19 | } | 18 | } |
20 | .i-icon-accessory:before { content: "\e6dd"; } | 19 | .i-icon-accessory:before { content: "\e6dd"; } |
21 | 20 | ||
@@ -297,6 +296,10 @@ | @@ -297,6 +296,10 @@ | ||
297 | <Icon custom="i-icon i-icon-video" size="24" color="#ff6600" /> | 296 | <Icon custom="i-icon i-icon-video" size="24" color="#ff6600" /> |
298 | <Icon custom="i-icon i-icon-time" /> | 297 | <Icon custom="i-icon i-icon-time" /> |
299 | <Icon type="ionic" /> | 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 | <hr> | 303 | <hr> |
301 | <Button>Default</Button> | 304 | <Button>Default</Button> |
302 | <Button type="primary">Primary</Button> | 305 | <Button type="primary">Primary</Button> |
src/components/button/button.vue
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | :disabled="disabled" | 5 | :disabled="disabled" |
6 | @click="handleClick"> | 6 | @click="handleClick"> |
7 | <Icon class="ivu-load-loop" type="load-c" v-if="loading"></Icon> | 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 | <span v-if="showSlot" ref="slot"><slot></slot></span> | 9 | <span v-if="showSlot" ref="slot"><slot></slot></span> |
10 | </button> | 10 | </button> |
11 | </template> | 11 | </template> |
@@ -42,7 +42,14 @@ | @@ -42,7 +42,14 @@ | ||
42 | return oneOf(value, ['button', 'submit', 'reset']); | 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 | long: { | 53 | long: { |
47 | type: Boolean, | 54 | type: Boolean, |
48 | default: false | 55 | default: false |
@@ -63,7 +70,7 @@ | @@ -63,7 +70,7 @@ | ||
63 | [`${prefixCls}-${this.shape}`]: !!this.shape, | 70 | [`${prefixCls}-${this.shape}`]: !!this.shape, |
64 | [`${prefixCls}-${this.size}`]: !!this.size, | 71 | [`${prefixCls}-${this.size}`]: !!this.size, |
65 | [`${prefixCls}-loading`]: this.loading != null && this.loading, | 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 | } |