Commit afafafce6e741ff93cff9f6a91bb8cab95320e7b

Authored by 梁灏
1 parent acf00f5c

Avatar add custom-icon prop

examples/routers/avatar.vue
... ... @@ -30,6 +30,8 @@
30 30 <Avatar shape="square" icon="ios-person" />
31 31 </Badge>
32 32 </div>
  33 + <br><br><br>
  34 + <Avatar custom-icon="ivu-icon-ios-person" />
33 35 </div>
34 36 </template>
35 37 <script>
... ...
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 },
... ...