配套demo代码https://github.com/lujianNB/supermap-mapboxgl.git
安装依赖
开发时需要引入 MapboxGL v1 和 SuperMap iClient for MapboxGL(这里只讲通过npm安装的方式)
- 安装SuperMap iClient for MapboxGL
npm install @supermap/iclient-mapboxgl
- 安装 @supermap/babel-plugin-import
npm install @supermap/babel-plugin-import -D
- 在.babelrc 中添加如下配置
{
"plugins": [
["@supermap/babel-plugin-import",
{
"libraryName": "@supermap/iclient-mapboxgl"
}
]
]
}
- 引入 CSS
<link rel="stylesheet" href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css"/>
<link href="https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.min.css" rel="stylesheet"/>