Optimize progress bar

This commit is contained in:
qingwei.li
2016-12-17 09:01:21 +08:00
parent 8b719238e6
commit e58c17fdc6
2 changed files with 14 additions and 1 deletions

View File

@@ -1,3 +1,7 @@
## 1.1.1
### Bug fixes
- Optimize progress bar
## 1.1.0
## Features
- Add progress bar

View File

@@ -122,7 +122,16 @@ export function renderLoading ({ loaded, total }) {
document.body.appendChild(div)
CACHE['loading'] = div
}
CACHE['loading'].style.width = num >= 95 ? '0%' : num + '%'
CACHE['loading'].style.opacity = 1
CACHE['loading'].style.width = num + '%'
if (num >= 95) {
clearTimeout(renderLoading.cacheTImeout)
renderLoading.cacheTImeout = setTimeout(_ => {
CACHE['loading'].style.opacity = 0
CACHE['loading'].style.width = '0%'
}, 200)
}
}
/**