Commit 9419e0c52c773d4d32ba0beac760c8d1798be97e
Committed by
GitHub
Merge pull request #107 from jingsam/button
Use Icon component in Button
Showing
1 changed file
with
2 additions
and
14 deletions
Show diff stats
src/components/button/button.vue
1 | 1 | <template> |
2 | 2 | <button :type="htmlType" :class="classes" :disabled="disabled"> |
3 | - <i :class="loadingIconClasses" v-if="loading"></i> | |
4 | - <i :class="typeIconClasses" v-if="icon && !loading"></i> | |
3 | + <Icon class="ivu-load-loop" type="load-c" v-if="loading"></Icon> | |
4 | + <Icon :type="icon" v-if="icon && !loading"></Icon> | |
5 | 5 | <span v-if="showSlot" v-el:slot><slot></slot></span> |
6 | 6 | </button> |
7 | 7 | </template> |
... | ... | @@ -10,7 +10,6 @@ |
10 | 10 | import { oneOf } from '../../utils/assist'; |
11 | 11 | |
12 | 12 | const prefixCls = 'ivu-btn'; |
13 | - const iconPrefixCls = 'ivu-icon'; | |
14 | 13 | |
15 | 14 | export default { |
16 | 15 | components: { Icon }, |
... | ... | @@ -62,17 +61,6 @@ |
62 | 61 | [`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading) |
63 | 62 | } |
64 | 63 | ] |
65 | - }, | |
66 | - loadingIconClasses () { | |
67 | - return `${iconPrefixCls} ivu-load-loop ${iconPrefixCls}-load-c`; | |
68 | - }, | |
69 | - typeIconClasses () { | |
70 | - return [ | |
71 | - `${iconPrefixCls}`, | |
72 | - { | |
73 | - [`${iconPrefixCls}-${this.icon}`]: !!this.icon | |
74 | - } | |
75 | - ] | |
76 | 64 | } |
77 | 65 | }, |
78 | 66 | compiled () { | ... | ... |