Commit 81b328c6f1ccaccd168bf20774fba1d7c457ae7f

Authored by Hsiaoming Yang
Committed by GitHub
1 parent 71ef4865

Patch fix on Avatar component

There are chances that when there is this.$slots.default there is no this.$refs.children.
Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
src/components/avatar/avatar.vue
@@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
71 methods: { 71 methods: {
72 setScale () { 72 setScale () {
73 this.isSlotShow = !this.src && !this.icon; 73 this.isSlotShow = !this.src && !this.icon;
74 - if (this.$slots.default) { 74 + if (this.$refs.children) {
75 const childrenWidth = this.$refs.children.offsetWidth; 75 const childrenWidth = this.$refs.children.offsetWidth;
76 const avatarWidth = this.$el.getBoundingClientRect().width; 76 const avatarWidth = this.$el.getBoundingClientRect().width;
77 // add 4px gap for each side to get better performance 77 // add 4px gap for each side to get better performance
@@ -90,4 +90,4 @@ @@ -90,4 +90,4 @@
90 this.setScale(); 90 this.setScale();
91 } 91 }
92 }; 92 };
93 -</script>  
94 \ No newline at end of file 93 \ No newline at end of file
  94 +</script>