背景:用官方生成项目命令:
npx create-ol-app my-app --template vite
会产生
could not find commit hash for HEAD 错误。
苹果电脑上则一切正常,特此把生成的项目放上来。
另外代码本身仅仅提供了openlayer加载天地地图的基本知识点。
启动环境及步骤:
node -v
18.20.4
启动
npm install
npm start
预览
1、td.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quick Start</title>
</head>
<body>
<div id="map"></div>
<script type="module" src="./td.js"></script>
</body>
</html>
2、td.js
import './style.css';
impor