Vue使用NProgress


NProgress是頁面跳轉是出現在瀏覽器頂部的進度條
官網:http://ricostacruz.com/nprogress/
github:https://github.com/rstacruz/nprogress

 

 

1、安裝

$ npm install --save nprogress 或者
$ yarn add nprogress

//用法

NProgress.start();
NProgress.done();

2、使用

router.js

//導入
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

router.beforeEach((to, from, next) => {
NProgress.start()
next()
})

router.afterEach(() => {
NProgress.done()
})

3、顏色值更改

App.vue中的style中增加:

    #nprogress .bar {
      background: red !important; //自定義顏色
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM