vue使用nprogress加載路由進(jìn)度條的方法
1、效果圖
2、安裝
npm install --save nprogress
基本用法
NProgress.start();NProgress.done();
3、在路由中使用
import NProgress from ’nprogress’import ’nprogress/nprogress.css’router.beforeEach((to, from, next) => { NProgress.start(); next();});router.afterEach(() => { NProgress.done();});
PS:下面看下Vue使用NProgress的方法
NProgress是頁(yè)面跳轉(zhuǎn)是出現(xiàn)在瀏覽器頂部的進(jìn)度條
官網(wǎng):http://ricostacruz.com/nprogress/
github:https://github.com/rstacruz/nprogress
如下圖所示,綠色的進(jìn)度條就是NProgress實(shí)現(xiàn)的效果
1、安裝
$ npm install --save nprogress 或者$ yarn add nprogress//用法NProgress.start();NProgress.done();
2、使用
//導(dǎo)入import NProgress from ’nprogress’import ’nprogress/nprogress.css’router.beforeEach((to, from, next) => { NProgress.start() next()})router.afterEach(() => { NProgress.done()})
總結(jié)
到此這篇關(guān)于vue使用nprogress加載路由進(jìn)度條的文章就介紹到這了,更多相關(guān)vue nprogress路由進(jìn)度條內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. asp取整數(shù)mod 有小數(shù)的就自動(dòng)加12. 詳解瀏覽器的緩存機(jī)制3. CSS3中Transition屬性詳解以及示例分享4. 詳解盒子端CSS動(dòng)畫(huà)性能提升5. 利用CSS制作3D動(dòng)畫(huà)6. 怎樣才能用js生成xmldom對(duì)象,并且在firefox中也實(shí)現(xiàn)xml數(shù)據(jù)島?7. CSS hack用法案例詳解8. 怎樣打開(kāi)XML文件?xml文件如何打開(kāi)?9. css代碼優(yōu)化的12個(gè)技巧10. XML入門(mén)的常見(jiàn)問(wèn)題(二)
