https://github.com/vortesnail/qier-progress
:dancer: Look at me, I am a slim progress bar and very colorful / 支持彩色或单色的顶部进度条
https://github.com/vortesnail/qier-progress
progress progress-bar qier-progress qprogress
Last synced: 8 months ago
JSON representation
:dancer: Look at me, I am a slim progress bar and very colorful / 支持彩色或单色的顶部进度条
- Host: GitHub
- URL: https://github.com/vortesnail/qier-progress
- Owner: vortesnail
- License: mit
- Created: 2020-02-06T13:49:43.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T10:02:07.000Z (over 2 years ago)
- Last Synced: 2024-10-14T22:43:00.280Z (about 1 year ago)
- Topics: progress, progress-bar, qier-progress, qprogress
- Language: TypeScript
- Homepage: https://vortesnail.github.io/qier-progress/
- Size: 1.51 MB
- Stars: 400
- Watchers: 8
- Forks: 20
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- hub - qier-progress
README
Slim progress bars for anywhere you want to use
[](https://www.npmjs.com/package/qier-progress) [](https://www.npmjs.com/package/qier-progress) [](https://www.npmjs.com/package/qier-progress) [](https://travis-ci.org/vortesnail/qier-progress) [](https://coveralls.io/github/vortesnail/qier-progress?branch=master)
[简体中文](./READM-zh-CN.md) | English
## Introduction
`qier-progress` is a progress bar. It can be used for some watting time like jump links, request data, and load or upload files and images to give us feedback and reduce our anxiety. Also if you have used [nprogress](https://github.com/rstacruz/nprogress), then you must know what I am talking about ~
💃[check demo](https://vortesnail.github.io/qier-progress/)
## Quick Start
#### 🛠 Install
```javascript
npm install --save qier-progress
```
#### 📦 Use
Firstly, import module in Vue, React, Angular wherever es6 module is supported .
```javascript
import QProgress from 'qier-progress'
```
Secondly, create instance.
```javascript
const qprogress = new QProgress()
```
Thirdly, simply call `start()` and `finish()` to control the progress bar.
```javascript
qprogress.start()
qprogress.finish()
```
## Advanced usage
#### 📌 Set progress value:
Use `.set(n)` to set a progress percentage, where  is a number between `0..1` .
```javascript
qprogress.set(0.0) // same as .start()
qprogress.set(0.6)
qprogress.set(1.0) // same as .finish()
```
#### 🎢 Increase manually:
Use `.inc(n)` to increment the progress bar, but it will stop increasing after reaching the threshold, means it will never reach `100%` .
```javascript
qprogress.inc()
qprogress.inc(0.2) // specific value you want
```
#### 🥣 Forced finished:
Use `.finish()` to unmount the progress var, of course, there will also have an end process animation.
```javascript
qprogress.finish()
```
#### 🧮 Get current progress value:
Use `.status` to get current value  where is a number between `0..1` .
```javascript
qprogress.status
```
## Configuration
#### 🤔 How to customize
When creating an instance, you can customize some parameters like this:
```javascript
const qprogress = new QProgress({
minimum: 0.08,
height: 3,
color: '#17829f'
})
```
#### 📕 Configuration list
| Parameter | Description | Type | Default |
| --- | --- | --- | --- |
| `minimum` | Minimum percentage used upon starting. | number(0..1) | 0.12 |
| `height` | Progress bar's height, unit is `px` . | number | 2 |
| `color` | Progress bar's color, support RGB. | string | '#1890ff' |
| `colorful` | Colorful mode switch. | boolean | true |
| `easing` | Css transition property `time-function` . | string | 'ease' |
| `speed` | Css transition property `duration` , unit is `ms` . | number | 400 |
| `trickle` | Automatic incrementing behavior switch. | boolean | true |
| `trickleSpeed` | Automatic incrementing speed, means increment interval, unit is `ms` . | number | 400 |
| `parentNode` | Specify this to change the parent container. | Element | string | 'body' |
## Contribution
Welcome to participate in this project, please read [CONTRIBUTING](ssd) carefully.
## Inspiration and purpose
First of all, I am a beginner of `typescript` . When I enjoy the convenience brought by [nprogress](https://github.com/rstacruz/nprogress), I hope that I can learn a little bit from it, so I retyped this plugin using `typescript` and added some other features. I learned a lot of coding knowledge in the process, and finally I sincerely thank the [nprogress contributors](https://github.com/rstacruz/nprogress/graphs/contributors) very much, respect!
## About me
[](https://github.com/vortesnail) [](https://juejin.im/user/5da573d3f265da5b8a5168a6) [](https://space.bilibili.com/80755916) [](https://www.zhihu.com/people/vortesnail)
## License
[MIT](./LICENSE)