Skip to content

Commit 6d7c4c7

Browse files
authored
fix(Icon): supplementary exception catching (#3370)
1 parent c5f2038 commit 6d7c4c7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/icon/icon.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ export default class Icon extends SuperComponent {
4141

4242
this.setData({ isImage }, async () => {
4343
if (isImage) {
44-
const { height } = await getRect(this, `.${classPrefix}`);
45-
const iconSize = sizeValue || addUnit(height);
44+
let iconSize = sizeValue;
45+
if (!iconSize) {
46+
await getRect(this, `.${classPrefix}`)
47+
.then((res) => {
48+
iconSize = addUnit(res?.height);
49+
})
50+
.catch(() => {});
51+
}
4652

4753
iconStyle.width = iconSize;
4854
iconStyle.height = iconSize;

0 commit comments

Comments
 (0)