在设置style样式时,发现不起作用,需要设置一个属性 extractStyles: false
import VectorLayer from 'ol/layer/Vector'
import VectorSource from 'ol/source/Vector'
import KML from 'ol/format/KML'
createWFS (option) {
const WFS = new VectorLayer({
source: new VectorSource({
url: option.url,
format: new KML({
extractStyles: false
})
}),
style: option.style
})
return WFS
}