Merge pull request #47 from miranquil/master

fix: fix NaN and Infinity displayed in short page
This commit is contained in:
指间的诗意 2021-01-23 01:04:55 +08:00 committed by GitHub
commit 22b5431823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,8 @@ KEEP.initUtils = () => {
const percent_dom = this.back2TopButton_dom.querySelector('.percent'); const percent_dom = this.back2TopButton_dom.querySelector('.percent');
if (percent === '0') { if (percent === '0') {
this.back2TopButton_dom.style.display = 'none'; this.back2TopButton_dom.style.display = 'none';
} if (percent !== percent || !isFinite(percent)) {
this.back2TopButton_dom.style.display = 'none';
} else { } else {
this.back2TopButton_dom.style.display = 'flex'; this.back2TopButton_dom.style.display = 'flex';
percent_dom.innerHTML = percent; percent_dom.innerHTML = percent;