110 lines
2.8 KiB
Markdown
110 lines
2.8 KiB
Markdown
### 目录查看
|
||
|
||
1. node_modules:安装依赖打包
|
||
2. public:图片文件,index.html
|
||
3. src:
|
||
1. api:调用接口使用的js文件
|
||
2. assets:图片文件
|
||
3. components:vue组件文件页面处理
|
||
4. config:request.js,请求配置token设置。
|
||
5. filters:index.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. forgetPassowrd:fogetPassword.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:
|
||
|
||
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/' // 路径重写
|
||
}
|
||
}
|
||
}
|
||
},
|
||
```
|
||
|