# im-erp **Repository Path**: scobiser/im-erp ## Basic Information - **Project Name**: im-erp - **Description**: erp管理系统 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-04-17 - **Last Updated**: 2025-04-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ERP 账单管理、财务软件 node version v14.19.3 ## Project setup ``` yarn install ``` ### Compiles and hot-reloads for development ``` yarn run serve ``` ### Compiles and minifies for production ``` yarn run build ``` ### Run your tests ``` yarn run test ``` ### Lints and fixes files ``` npm run lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). ### 环境变量 && rd / qa - [https://cli.vuejs.org/zh/guide/mode-and-env.html](https://cli.vuejs.org/zh/guide/mode-and-env.html) ### 给打包后的文件添加 .min.js 后缀 - [参考文档 https://cli.vuejs.org/zh/guide/webpack.html#%E7%AE%80%E5%8D%95%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%B9%E5%BC%8F](https://cli.vuejs.org/zh/guide/webpack.html#%E7%AE%80%E5%8D%95%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%B9%E5%BC%8F) ### 查看 webpack 配置 生成 production 的 webpack 配置文件 ```bash $ vue inspect > output.js --mode rd ``` 生成 development 的 webpack 配置文件 ```bash $ vue inspect > output.js ``` ### 代码结构 & 代码风格 项目的风格指南主要是参照 vue 官方的[风格指南](https://cn.vuejs.org/v2/style-guide/)。在真正开始使用该项目之前建议先阅读一遍指南,这能帮助让你写出更规范和统一的代码。 - 1. 页面组件入口组件小写开头,多个单词使用`-`隔开 比如:hello-world.vue index.vue 使用横线连接 (kebab-case)来命名 views 主要是出于以下几个考虑。横线连接 (kebab-case) 也是官方推荐的命名规范之一 [文档](https://cn.vuejs.org/v2/style-guide/index.html#%E5%8D%95%E6%96%87%E4%BB%B6%E7%BB%84%E4%BB%B6%E6%96%87%E4%BB%B6%E7%9A%84%E5%A4%A7%E5%B0%8F%E5%86%99-%E5%BC%BA%E7%83%88%E6%8E%A8%E8%8D%90) views 下的.vue 文件代表的是一个路由,所以它需要和 component 进行区分(component 都是大写开头) 页面的 url 也都是横线连接的,比如`https://www.baidu.com/export-excel`,所以路由对应的 view 应该要保持统一没有大小写敏感问题 - 2. 其他组件一律大驼峰命名 比如:HelloWorld.vue ``` components 可复用,公共组件 Demo/index.vue Charts/Line.vue views 所有页面组件 home/index.vue 页面入口组件 home/detail.vue 详情页面组件 home/components 页面结构组件 DemoXxx1.vue DemoXxx2.vue DemoXxx3.vue ``` - 3. 其他,请参考 Vue 官方推荐的[风格指南--Vue.js](https://cn.vuejs.org/v2/style-guide/) ## 解决 Jenkins npm install node-sass 报错问题 [github issue](https://github.com/nodejs/node-gyp/issues/809#issuecomment-495147492) 就是部署的时候 删除 package-lock.json 文件就行 ## vue-cli3.x 开启 gzip 优化 [参考文章 https://www.jianshu.com/p/d402c1f7b519](https://www.jianshu.com/p/d402c1f7b519) [webpack 官网](https://webpack.js.org/plugins/compression-webpack-plugin/) 1. 安装依赖 ```bash $ npm i compression-webpack-plugin --save-dev ``` 2. 修改 vue.config.js 配置文件 ```js const productionGzipExtensions = /\.(js|css|html|svg)$/i; const CompressionWebpackPlugin = require('compression-webpack-plugin'); module.exports = { configureWebpack: config => { // https://cli.vuejs.org/zh/guide/webpack.html#%E7%AE%80%E5%8D%95%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%B9%E5%BC%8F if (process.env.NODE_ENV === 'production') { // 为生产环境修改配置... // config.output.filename = 'assets/js/[name].[contenthash:8].min.js'; // config.output.chunkFilename // = 'assets/js/[name].[contenthash:8].min.js'; config.plugins = [ ...config.plugins, new CompressionWebpackPlugin({ filename: '[path].gz[query]', algorithm: 'gzip', test: productionGzipExtensions, threshold: 2048, minRatio: 0.8 }) ]; } else { // 为开发环境修改配置... config.devtool = 'cheap-module-eval-source-map'; } } }; ``` ### lodash 打包优化 npm i babel-plugin-lodash lodash-webpack-plugin -D babel.config.js ```JS module.exports = { presets: ['@vue/app'], plugins: [ 'lodash', [ 'component', { libraryName: 'element-ui', styleLibraryName: 'theme-chalk' } ] ] }; ``` vue.config.js ```js const LodashModuleReplacementPlugin = require('lodash-webpack-plugin'); configureWebpack: config => { config.plugins.push( ...[ new LodashModuleReplacementPlugin(), // 链接:https://juejin.cn/post/6844904105555525640 new webpack.ContextReplacementPlugin( /moment[/\\]locale$/, // 这个参数表明了我们要改变的打包上下文 /zh-cn/ // 这个参数表示我们只想打包这个正则匹配的文件 ) ] ); ```