Skip to content

Commit

Permalink
fix(Icon): supplementary exception catching (#3370)
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao authored Dec 19, 2024
1 parent c5f2038 commit 6d7c4c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/icon/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ export default class Icon extends SuperComponent {

this.setData({ isImage }, async () => {
if (isImage) {
const { height } = await getRect(this, `.${classPrefix}`);
const iconSize = sizeValue || addUnit(height);
let iconSize = sizeValue;
if (!iconSize) {
await getRect(this, `.${classPrefix}`)
.then((res) => {
iconSize = addUnit(res?.height);
})
.catch(() => {});
}

iconStyle.width = iconSize;
iconStyle.height = iconSize;
Expand Down

0 comments on commit 6d7c4c7

Please sign in to comment.