Vue使用NProgress

NProgress是页面跳转是出现在浏览器顶部的进度条
官网:http://ricostacruz.com/nprogress/
githubhttps://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()
})

颜色修改:https://blog.csdn.net/wn1245343496/article/details/82082152

Original: https://www.cnblogs.com/rainbow70626/p/16452803.html
Author: rainbow70626
Title: Vue使用NProgress

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/553212/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球