Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: nig-772 #133

Merged
merged 3 commits into from
Apr 30, 2024
Merged

fix: nig-772 #133

merged 3 commits into from
Apr 30, 2024

Conversation

huangbinjie
Copy link

No description provided.

Copy link

linear bot commented Apr 28, 2024

</span>
<span>
Max unstake:
{stakeBalance == null ? (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这么多null判断,写个函数把这个stakeBalance转成number
function convertToNumber(str) {
// 如果字符串为 null,则返回 0
if (str === null) {
return 0;
}

// 尝试将字符串转换为数字
const num = parseFloat(str);

// 如果转换失败,则返回 0
if (isNaN(num)) {
return 0;
}

return num;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是故意转换成 null 来表示空的,0 没法表示空,因为加载完成后数据有可能就是 0

@huangbinjie huangbinjie merged commit 568fdf6 into main Apr 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants