Vue resolved in Baidu map covering local reference image issues

The main purpose is to reference the custom of covering in Baidu map, the path is again under the asset / images / folders, direct reference error. Need to re-import the references.

In the <script> </ script> tags added as follows:

 1     import gisGreen from '../assets/images/GIS_Green2.png';
 2     export default {……
 3         methods:{
 4             ……,
 5             handler ({BMap, map}) {
 6               var point = new BMap.Point(120.66, 31.20);
 7               map.centerAndZoom(point, 13);
 8               var myIcon = new BMap.Icon(gisGreen, new BMap.Size(20, 32));
 9               var marker = newBMap.Marker (Point, {icon: myIcon}); // create a label 
10                the Map.addOverlay (marker); // be added to the map labels 
11              }
 12          }         
13      }
 14     

 

Guess you like

Origin www.cnblogs.com/qianyou304/p/11805285.html