From 81b328c6f1ccaccd168bf20774fba1d7c457ae7f Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Sat, 16 Sep 2017 10:16:38 +0900 Subject: [PATCH] Patch fix on Avatar component There are chances that when there is this.$slots.default there is no this.$refs.children. --- src/components/avatar/avatar.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/avatar/avatar.vue b/src/components/avatar/avatar.vue index 38db80db..97d0d23d 100644 --- a/src/components/avatar/avatar.vue +++ b/src/components/avatar/avatar.vue @@ -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 @@ -90,4 +90,4 @@ this.setScale(); } }; - \ No newline at end of file +