单独js文件中el不能获取,通过以下方式获取1 var location = (window.location+‘‘).split(‘/‘); 2 var basePath = location[0]+‘//‘+location[2]+‘/‘+location[3]; 3 var url = basePath + ‘/js/xxx.js‘;
时间: 2024-12-29 19:20:21
单独js文件中el不能获取,通过以下方式获取1 var location = (window.location+‘‘).split(‘/‘); 2 var basePath = location[0]+‘//‘+location[2]+‘/‘+location[3]; 3 var url = basePath + ‘/js/xxx.js‘;