# vuecli2-prj **Repository Path**: carefree-fish/vuecli2-prj ## Basic Information - **Project Name**: vuecli2-prj - **Description**: vuecli2.0脚手架 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2019-05-23 - **Last Updated**: 2023-03-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vuecli2.0-prj > A Vue.js project ## Build Setup ``` bash # install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report # run unit tests npm run unit # run e2e tests npm run e2e # run all tests npm test ``` For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 1、vue init webpack project、 # 运行项目 2、cd project ------------进入工程目录 3、cnpm run dev ------------运行项目 # 打包工作,用于正式环境 4、cnpm run build #打包后有路径问题,解决方法:config/index.js/ 修改 assetsPublicPath: './',本项目禁用了eslint #在webpack.base.conf.js中注释了 const createLintingRule = () => ({ // test: /\.(js|vue)$/, // loader: 'eslint-loader', // enforce: 'pre', // include: [resolve('src'), resolve('test')], // options: { // formatter: require('eslint-friendly-formatter'), // emitWarning: !config.dev.showEslintErrorsInOverlay // } }) 5、index.html背景图引入路径的问题,图片路径应该在static中才成功引入 6、安装 可解析scss 的loader npm i node-sass sass-loader --save-dev 7、安装 vue-resource cnpm install vue-resource --save npm install vue-resource --save提示无权限,改cnpm安装就行 8、利用 vue-resource 发送请求 配置webpack代理服务器解决跨域问题 参考博客:https://www.cnblogs.com/zishang91/p/8909900.html config/index.js proxyTable: { '/api': { target: 'https://ssp.scnu.edu.cn/api/UserValidate.ashx', changeOrigin: true, secure: false,//https请求这里要写 pathRewrite: { //可以不写 '^/api': '' } } }, config/dev.env.js module.exports = merge(prodEnv, { NODE_ENV: '"development"', ocr: '"/ocr"', api:'"/api"' }) module.exports = { NODE_ENV: '"production"', ocr: '"//ssp.scnu.edu.cn/api/"', api:'"//ssp.scnu.edu.cn/api/"' } 9、小bug webpack打包后PC端网页css略有不同,高度不一样