2.8 KiB
2.8 KiB
目录查看
- node_modules:安装依赖打包
- public:图片文件,index.html
- src:
- api:调用接口使用的js文件
- assets:图片文件
- components:vue组件文件页面处理
- config:request.js,请求配置token设置。
- filters:index.js,时间格式化,变量转换。
- router:
- index.js,从接口获取路由配置之
- index备份.js:配置路由备份
- permission.js:权限校验是否有token,遍历路由权限校验
- router.config.js:免密登录白名单
- store:用户信息和权限处理
- nodules/user.js
- getters.js
- index.js
- styles:样式处理
- utils:工具类
- views
- dashboard:页面排版vue
- forgetPassowrd:fogetPassword.vue
- login:login.vue
- register:register.vue
- webView:webView.vue
- App.vue
- main.js:websocket
- registerServiceWorker.js:生产环境配置
- .env不同环境变量配置
- label.config.js
- package.json:包管理,启动打包
- vue.config.js:
vue-cli-service serve
总结
当配置baseURL时,代理不生效。
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' // 路径重写
// }
}
}
启动跟踪
npm run dev
文件:package.json
"dev": "webpack-dev-server --inline --progress --module-bind production --config build/webpack.dev.conf.js "
文件:build/webpack.dev.conf.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/' // 路径重写
}
}
}
},