(1)网络图片资源:直接写入路径
let marker = new AMap.Marker({
position: new AMap.LngLat(
item.location.lng,
item.location.lat
), // 经纬度坐标
title: item.formattedAddress, //标记城市名称
icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
offset: new AMap.Pixel(-13, -30)
});
(2)本地图片资源:使用require("路径")包裹本地图片路径
let marker = new AMap.Marker({
position: new AMap.LngLat(
item.location.lng,
item.location.lat
), // 经纬度坐标
title: item.formattedAddress, //标记城市名称
icon: require("../../../assets/icon/icon-baobiaoguanli2.png"),
offset: new AMap.Pixel(-13, -30)
});