/* * 1.前端目录:通过document.location.origin和document.currentScript属性取得 * 2.网关地址:跨域时需要填写具体地址并设置crossDomain为true */ const config = { debug: document.location.href.indexOf('localhost') !== -1, razor:false, crossDomain: false, path: document.currentScript.src.substring(document.location.origin.length, document.currentScript.src.length - 'js/config.js'.length), file: function (file) { return this.path + file; }, gateway: 'http://example_gateway_host/', service: function (service) { return (this.crossDomain ? this.gateway : '/') + service; } }; Vue.prototype.config = config;