使用产品:iclient 10i
问题详细描述:从基于Vue快速搭建超图二维iClient开发环境_supermapsupport的博客-CSDN博客下载的Leaflet示例程序,尝试运行报错
[vue warn]: Error in mounted hook : "TypeError: Cannot read properties of undefined(reading 'tiledMapLayer')
问题重现步骤:
1.
<template>
<div id="map"></div>
</template>
<script>
import L from "leaflet";
import "@supermap/iclient-leaflet";
export default {
name: "HelloWorld",
props: {
msg: String,
},
methods: {
mapInit() {
var url =
"https://iserver.supermap.io/iserver/services/map-world/rest/maps/World";
var map = L.map("map", {
crs: L.CRS.EPSG4326,
center: [0, 0],
maxZoom: 18,
zoom: 1,
});
L.supermap.tiledMapLayer(url).addTo(map);
},
},
mounted() {
this.mapInit();
},
};
</script>
<style scoped>
#map {
margin: 0;
overflow: hidden;
background: #fff;
width: 100%;
height: 100%;
position: absolute;
}
</style>