首先
npm i nprogress
其次在main.js中引入
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
然后在路由配置文件中添加
router.beforeEach((to, from, next) => { // 开启进度条 NProgress.start() next() })
router.afterEach(() => { // 关闭进度条 NProgress.done() })
首先
npm i nprogress
其次在main.js中引入
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
然后在路由配置文件中添加
router.beforeEach((to, from, next) => { // 开启进度条 NProgress.start() next() })
router.afterEach(() => { // 关闭进度条 NProgress.done() })