解决Vue项目统一url(兼容IE浏览器)
const config = {
url:‘http://127.0.0.1:8080’
}
function bindToGlobal(obj, key) {
if (typeof window[key] === ‘undefined’) {
window[key] = {};
}
for (let i in obj) {
window[key][i] = obj[i]
}
}
bindToGlobal(config,’{项目名}’)
使用时xxUrl = {项目名}.url+请求