首页 > 其他 > 详细

Vue使用NProgress

时间:2021-04-22 16:06:28      阅读:23      评论:0      收藏:0      [点我收藏+]
NProgress是页面跳转是出现在浏览器顶部的进度条
官网:http://ricostacruz.com/nprogress/
github:https://github.com/rstacruz/nprogress

如下图所示,绿色的进度条就是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()
})

参考---https://blog.csdn.net/wn1245343496/article/details/82151273

Vue使用NProgress

原文:https://www.cnblogs.com/pwindy/p/14688720.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!