项目优化小记(页面头部加载进度条和自动清除console)

一 页面头部加载进度条

nprogress 页面进度条
安装 npm install --save nprogress
在vue项目中使用
在main.js页面引入

// 引入
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

使用

// 展示进度条
NProgress.start()
// 隐藏进度条
NProgress.done()

在这里插入图片描述

二 vue-cli – build时自动清除console

安装 babel-plugin-transform-remove-console 移除 console.log()
npm install babel-plugin-transform-remove-console --save-dev
设置只在项目发布阶段使用 开发阶段不使用
打开 项目的 babel.config.js 文件
配置如下
在这里插入图片描述

发布了41 篇原创文章 · 获赞 2 · 访问量 1836

猜你喜欢

转载自blog.csdn.net/weixin_43883485/article/details/104986622