// public/url.js
var host = window.location.origin;
var ip = window.location.hostname;
window.globalConfig = {
"apiUri": host,
// "apiUri": "http://10.10.245.17:8086",
//控制页面多久请求一次数据。180000ms。即3分钟
"time": 600000,
//大屏标题
"title_1": "天津市河西区网络健康态势感知系统",
"title_2": "天津市河西区网络设备性能监控",
"title_3": "天津市河西区政务外网拓扑",
"imcThemeName": "imc-cool-blue",
"domain": ip
}
//public/index.html
<script src="./url.js" type="text/javascript"></script>
//src/config.js
import Vue from 'vue'
const API_BASE_URI = window.globalConfig.apiUri
const TIME = window.globalConfig.time
const TITLE1 = window.globalConfig.title_1
const TITLE2 = window.globalConfig.title_2
const TITLE3 = window.globalConfig.title_3
const IMC_THEME_NAME = window.globalConfig.imcThemeName
const DOMAIN = window.globalConfig.domain
const DATA_ALL = window.globalConfig.dataAll
const URLS = window.globalConfig.urls
Vue.prototype.time = TIME
Vue.prototype.title_2 = TITLE2
Vue.prototype.imcThemeName = IMC_THEME_NAME
Vue.prototype.dataAll = DATA_ALL
Vue.prototype.$urls = URLS
var config = {
API_BASE_URI,
TIME,
TITLE1,
TITLE2,
TITLE3,
IMC_THEME_NAME,
DOMAIN,
DATA_ALL,
URLS
}
export default config
//src/main.js
import './config';
// vue file
let time = this.$time;