You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-spms-vue/src/config/app.js

27 lines
619 B
JavaScript

/**
* 配置编译环境和线上环境之间的切换
*
* baseUrl: 域名地址
* routerMode: 路由模式
* imgBaseUrl: 图片所在域名地址
*
*/
import '../../public/config'
import '../../public/config.json'
import axios from 'axios'
import myReq from '@/utils/axios'
let BASE_URL = process.env.VUE_APP_BASE_API
let SERVER_IP = ''
let ROUTER_MODE = ''
let IMG_BASE_URL = BASE_URL
export { BASE_URL, ROUTER_MODE, IMG_BASE_URL, SERVER_IP }
axios.get('./config.json').then((res) => {
// 基础地址
BASE_URL = res.data.BASE_URL
SERVER_IP = res.data.SERVER_IP
myReq.defaults.baseURL = BASE_URL
})