Commit afafafce6e741ff93cff9f6a91bb8cab95320e7b
1 parent
acf00f5c
Avatar add custom-icon prop
Showing
2 changed files
with
9 additions
and
3 deletions
Show diff stats
examples/routers/avatar.vue
src/components/avatar/avatar.vue
| 1 | 1 | <template> |
| 2 | 2 | <span :class="classes"> |
| 3 | 3 | <img :src="src" v-if="src"> |
| 4 | - <Icon :type="icon" v-else-if="icon"></Icon> | |
| 4 | + <Icon :type="icon" :custom="customIcon" v-else-if="icon || customIcon"></Icon> | |
| 5 | 5 | <span ref="children" :class="[prefixCls + '-string']" :style="childrenStyle" v-else><slot></slot></span> |
| 6 | 6 | </span> |
| 7 | 7 | </template> |
| ... | ... | @@ -34,7 +34,11 @@ |
| 34 | 34 | }, |
| 35 | 35 | icon: { |
| 36 | 36 | type: String |
| 37 | - } | |
| 37 | + }, | |
| 38 | + customIcon: { | |
| 39 | + type: String, | |
| 40 | + default: '' | |
| 41 | + }, | |
| 38 | 42 | }, |
| 39 | 43 | data () { |
| 40 | 44 | return { |
| ... | ... | @@ -52,7 +56,7 @@ |
| 52 | 56 | `${prefixCls}-${this.size}`, |
| 53 | 57 | { |
| 54 | 58 | [`${prefixCls}-image`]: !!this.src, |
| 55 | - [`${prefixCls}-icon`]: !!this.icon | |
| 59 | + [`${prefixCls}-icon`]: !!this.icon || !!this.customIcon | |
| 56 | 60 | } |
| 57 | 61 | ]; |
| 58 | 62 | }, | ... | ... |