不显示的代码
image: new ol.style.Icon({
anchor: [0.5, 60],
anchorOrigin: 'top-right',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
offsetOrigin: 'top-right',
offset: [0, 10],
//图标缩放比例
scale: 0.5,
//透明度
opacity: 0.75,
//图标的url
src: '../assets/image/blueIcon.png',
}),
解决
image: new ol.style.Icon({
anchor: [0.5, 60],
anchorOrigin: 'top-right',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
offsetOrigin: 'top-right',
offset: [0, 10],
//图标缩放比例
scale: 0.5,
//透明度
opacity: 0.75,
//图标的url
src: require('../assets/image/blueIcon.png'),
}),
src这里的坑
src: require(‘…/assets/image/blueIcon.png’),