1、nprogress:就是页面顶部有进度条和loading,让移动端体验更好
先看效果

npm install --save nprogress
直接调用 start()或者done()来控制进度条。其他具体看官网: nprogress的简介及使用教程 - Made with Vuejs
router.js
// 插件自带的css
// import 'nprogress/nprogress.css'
// 这是自定义的css
import '@/common/css/nprogress.css'
import NProgress from 'nprogress'
// 以下俩段是解决 使用$router.push跳转到一个相同的路由时报错 问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
return originalPush.call(this, location).catch(err => err)
}
const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (location) {
return originalReplace.call(this, loc

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



