Git Product home page Git Product logo

qier-progress's Introduction

Slim progress bars for anywhere you want to use

npm version package size download Build Status Coverage Status

简体中文 | 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, then you must know what I am talking about ~

💃check demo

Quick Start

🛠 Install

npm install --save qier-progress

📦 Use

Firstly, import module in Vue, React, Angular wherever es6 module is supported .

import QProgress from 'qier-progress'

Secondly, create instance.

const qprogress = new QProgress()

Thirdly, simply call start() and finish() to control the progress bar.

qprogress.start()
qprogress.finish()

Advanced usage

📌 Set progress value:

Use .set(n) to set a progress percentage, where is a number between 0..1 .

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% .

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.

qprogress.finish()

🧮 Get current progress value:

Use .status to get current value  where is a number between 0..1 .

qprogress.status

Configuration

🤔 How to customize

When creating an instance, you can customize some parameters like this:

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 carefully.

Inspiration and purpose

First of all, I am a beginner of typescript . When I enjoy the convenience brought by 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 very much, respect!

About me

Github.svg juejin-02.svg 哔哩哔哩.svg 知乎.svg

License

MIT

qier-progress's People

Contributors

vortesnail avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.