怎么动态添加google map api js文件

2026年09月17日 23:20
有1个网友回答
网友(1):



这个链接自带document.write()方法
window.google = window.google || {};
google.maps = google.maps || {};
(function() {

function getScript(src) {
document.write('<' + 'script src="' + src + '"><' + '/script>');
}

var modules = google.maps.modules = {};
google.maps.__gjsload__ = function(name, text) {
modules[name] = text;
};