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. python switch 實(shí)現(xiàn)多分支選擇功能2. IntelliJ IDEA設(shè)置背景圖片的方法步驟3. Spring使用AspectJ的注解式實(shí)現(xiàn)AOP面向切面編程4. Spring Cache和EhCache實(shí)現(xiàn)緩存管理方式5. idea設(shè)置代碼格式化的方法步驟6. ASP實(shí)現(xiàn)加法驗(yàn)證碼7. 八種Vue組件間通訊方式合集(推薦)8. 在JSP中使用formatNumber控制要顯示的小數(shù)位數(shù)方法9. JSP實(shí)現(xiàn)百萬(wàn)富翁猜數(shù)字游戲10. XML入門的常見(jiàn)問(wèn)題(四)
