标签:必须 fun route css ogre pre 入口 out imp
入口文件,main.js引入 nprogress
import App from ‘./App‘
import VueRouter from ‘vue-router‘
import router from ‘./router‘ //你的路由文件
//引入nprogress
import NProgress from ‘nprogress‘
import ‘nprogress/nprogress.css‘ //这个样式必须引入
Vue.use(VueRouter)
// 简单配置
NProgress.inc(0.2)
NProgress.configure({ easing: ‘ease‘, speed: 500, showSpinner: false })
router.beforeEach((to,from,next) => {
NProgress.start()
next()
})
router.afterEach(() => {
NProgress.done()
})
new Vue({
el: ‘#app‘,
router,
render: h => h(App)
})
标签:必须 fun route css ogre pre 入口 out imp
原文地址:https://www.cnblogs.com/shaozhu520/p/10612712.html