Merge pull request #807 from zhowiny/master
fix: 修复avatar组件在部分缩放比例下出现页面卡死 #116
This commit is contained in:
commit
9dd4cb03d8
1 changed files with 14 additions and 2 deletions
|
@ -45,7 +45,8 @@
|
|||
prefixCls: prefixCls,
|
||||
scale: 1,
|
||||
childrenWidth: 0,
|
||||
isSlotShow: false
|
||||
isSlotShow: false,
|
||||
slotTemp: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -85,6 +86,11 @@
|
|||
return style;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
size (val, oldVal) {
|
||||
if (val !== oldVal) this.setScale();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setScale () {
|
||||
this.isSlotShow = !this.src && !this.icon;
|
||||
|
@ -104,11 +110,17 @@
|
|||
this.$emit('on-error', e);
|
||||
}
|
||||
},
|
||||
beforeCreate () {
|
||||
this.slotTemp = this.$slots.default;
|
||||
},
|
||||
mounted () {
|
||||
this.setScale();
|
||||
},
|
||||
updated () {
|
||||
this.setScale();
|
||||
if (this.$slots.default !== this.slotTemp) {
|
||||
this.slotTemp = this.$slots.default;
|
||||
this.setScale();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue