Patch fix on Avatar component

There are chances that when there is this.$slots.default there is no this.$refs.children.
This commit is contained in:
Hsiaoming Yang 2017-09-16 10:16:38 +09:00 committed by GitHub
parent 71ef48658c
commit 81b328c6f1

View file

@ -71,7 +71,7 @@
methods: {
setScale () {
this.isSlotShow = !this.src && !this.icon;
if (this.$slots.default) {
if (this.$refs.children) {
const childrenWidth = this.$refs.children.offsetWidth;
const avatarWidth = this.$el.getBoundingClientRect().width;
// add 4px gap for each side to get better performance