后续会继续更新好用的前端插件
推荐一些好用的前端插件
webpackbar
作用:打包展示对应的进度 用法:
npm i --save webpackbar
var WebpackBar = require('webpackbar')
module.exports = {
configureWebpack:(config)=>{
config.plugins.push(
new WebpackBar()
)
}
}
NProgress
作用:页面加载进度条 用法:
npm i --save nprogress
import Vue from 'vue'
import Router from 'vue-router'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
NProgress.configure({
showSpinner: false,
})
Vue.use(Router)
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch((err) => err)
}
const router = new Router({
mode: 'hash',
routes: [
{
path:'/',
redirect:'/home'
}
],
})
router.beforeEach((to,from,next)=>{
NProgress.start()
next()
})
router.afterEach(()=>{
NProgress.done()
})
|