需求:
获取浏览器地址,动态添加base中的href,为了设置路径
window.location.protocol+"//"+window.location.host;
window.location.host;
window.location.hostname;
window.location.href;
window.location.pathname;
window.location.protocol;
window.location.port
<!-- <base href="http://192.168.0.6:1603/scs/" id="baseHead">-->
<base href="" id="baseHead">
<script>
let localHref = window.location.href;
let courentIp2 = window.location.protocol+"//"+window.location.host + ':' + window.location.port ;
var url = localHref.split('?')[0].split('/');
let getLocalHref = url[0] + '//' + url[2] + '/' + url[3] + '/';
console.log(getLocalHref);
let baseHref = document.getElementById('baseHead');
baseHref.href = getLocalHref;
var basePath = '';
var openLayersURL='';
var nginxHttpUrl='';
var nginxIp = '';
var VueComponent={};
</script>