获取项目根路径
var baseUrl = document.location.origin
console.log(baseUrl);
结果:http://localhost:8081
var baseUrl = document.location.pathname.substr(0,document.location.pathname.substr(1).indexOf("/")+1)+"/";
console.log(baseUrl);
//获取项目根路径
获取项目根路径
var baseUrl = document.location.origin
console.log(baseUrl);
结果:http://localhost:8081
var baseUrl = document.location.pathname.substr(0,document.location.pathname.substr(1).indexOf("/")+1)+"/";
console.log(baseUrl);
//获取项目根路径