project/vue/erp-web.md

110 lines
2.8 KiB
Markdown
Raw Normal View History

2022-01-21 21:02:50 -05:00
### 目录查看
1. node_modules安装依赖打包
2. public图片文件index.html
3. src:
1. api:调用接口使用的js文件
2. assets:图片文件
3. componentsvue组件文件页面处理
4. configrequest.js请求配置token设置。
5. filtersindex.js时间格式化变量转换。
6. router
1. index.js,从接口获取路由配置之
2. index备份.js配置路由备份
3. permission.js权限校验是否有token遍历路由权限校验
4. router.config.js免密登录白名单
7. store:用户信息和权限处理
1. nodules/user.js
2. getters.js
3. index.js
8. styles样式处理
9. utils工具类
10. views
1. dashboard页面排版vue
2. forgetPassowrdfogetPassword.vue
3. login:login.vue
4. register:register.vue
5. webView:webView.vue
11. App.vue
12. main.js:websocket
13. registerServiceWorker.js:生产环境配置
14. .env不同环境变量配置
15. label.config.js
16. package.json包管理,启动打包
17. vue.config.js:
2022-01-21 21:02:50 -05:00
vue-cli-service serve
### 总结
当配置baseURL时代理不生效。
```js
const request = axios.create({
timeout: 30000, // 请求超时时间
baseURL: process.env.VUE_APP_URL,
withCredentials: true
});
proxy: {
'/': { // 代理api
target: 'http://localhost:8085', // 服务器api地址
changeOrigin: true//, // 是否跨域
// pathRewrite: {
// '^/': 'http://qiankun.bj-fanuc.com.cn/finance-admin/charts/selectChartDataByPageModel' // 路径重写
// }
}
}
```
## 启动跟踪
```js
npm run dev
```
文件package.json
```json
"dev": "webpack-dev-server --inline --progress --module-bind production --config build/webpack.dev.conf.js "
```
文件build/webpack.dev.conf.js
```js
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
},
proxy: {
'/*': { // 代理api
target: 'http://localhost8080/', // 服务器api地址
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/*': 'http://localhost:8081/' // 路径重写
}
}
}
},
```