fixed #5136
This commit is contained in:
parent
4c534a7739
commit
1d5d6ef609
2 changed files with 11 additions and 2 deletions
|
@ -32,6 +32,8 @@
|
||||||
</div>
|
</div>
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
<Avatar custom-icon="ivu-icon-ios-person" />
|
<Avatar custom-icon="ivu-icon-ios-person" />
|
||||||
|
|
||||||
|
<Avatar :src="src" size="large" @on-error="handleError" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -42,7 +44,8 @@
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
user: UserList[0],
|
user: UserList[0],
|
||||||
color: ColorList[0]
|
color: ColorList[0],
|
||||||
|
src: 'https://dev-file.iviewui.com/userinfoPDvn9gKWYihR24SpgC319vXY8qniCqj41/avatar'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -50,6 +53,9 @@
|
||||||
const index = UserList.indexOf(this.user);
|
const index = UserList.indexOf(this.user);
|
||||||
this.user = index < UserList.length - 1 ? UserList[index + 1] : UserList[0];
|
this.user = index < UserList.length - 1 ? UserList[index + 1] : UserList[0];
|
||||||
this.color = index < ColorList.length - 1 ? ColorList[index + 1] : ColorList[0];
|
this.color = index < ColorList.length - 1 ? ColorList[index + 1] : ColorList[0];
|
||||||
|
},
|
||||||
|
handleError () {
|
||||||
|
this.src = 'https://dev-file.iviewui.com/userinfoPDvn9gKWYihR24SpgC319vXY8qniCqj4/avatar';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<span :class="classes">
|
<span :class="classes">
|
||||||
<img :src="src" v-if="src">
|
<img :src="src" v-if="src" @error="handleError">
|
||||||
<Icon :type="icon" :custom="customIcon" v-else-if="icon || customIcon"></Icon>
|
<Icon :type="icon" :custom="customIcon" v-else-if="icon || customIcon"></Icon>
|
||||||
<span ref="children" :class="[prefixCls + '-string']" :style="childrenStyle" v-else><slot></slot></span>
|
<span ref="children" :class="[prefixCls + '-string']" :style="childrenStyle" v-else><slot></slot></span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -89,6 +89,9 @@
|
||||||
this.scale = 1;
|
this.scale = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
handleError (e) {
|
||||||
|
this.$emit('on-error', e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue