whyczyk
2021-03-15 480eb7033d94f40b7c658cc3829852d246981f93
axios 配置
2个文件已修改
1个文件已添加
37 ■■■■■ 已修改文件
dist.zip 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/axios.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dist.zip
Binary files differ
public/index.html
@@ -1,17 +1,21 @@
<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <title>大屏可视化驾驶舱</title>
</head>
<body>
  <noscript>
    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
      Please enable it to continue.</strong>
  </noscript>
  <div id="app"></div>
  <!-- built files will be auto injected -->
</body>
</html>
src/assets/js/axios.js
@@ -5,6 +5,9 @@
    // 跨域请求
    axios.defaults.baseURL = 'http://localhost:8090/screen';
    axios.defaults.withCredentials = true; // 保持请求头
} else {
    axios.defaults.baseURL = '/screen';
    axios.defaults.withCredentials = true; // 保持请求头
}
// 添加请求拦截器
axios.interceptors.request.use(function (config) {