高德地图(异步实现(回调函数))

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
			<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=c6e183994605d131f97132d2f296d713">
				
			</script> 
	<style>
		*{padding: 0px;margin: 0px;}
		#container{width:100%; height: 1000px; }  
	</style>

</head>
<body>
<div  id="container">
	
</div>

<script>
	function init()
	{
		new AMap.Map("container");
	}
	let callback=init;
	callback();
	//简单的说起来就是把函数名复赋值给一个变量,然后变量加()就变成了一个函数了.
</script>
</body>
</html>
posted @ 2020-08-04 20:03  贵哥的编程之路  阅读(112)  评论(0)    收藏  举报