未验证 提交 91e7f7f7 编写于 作者: Z zhowiny 提交者: GitHub

fix: 修复avatar组件在部分缩放比例下出现页面卡死 #116

修复调整缩放比例,刷新页面,导致无限更新this.scale,出现卡死状况
上级 6ee13b13
......@@ -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: function (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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册