-
Notifications
You must be signed in to change notification settings - Fork 140
Closed
Labels
Description
I am using v-for to dynamically add and remove layers that are added to an array:
<MglGeojsonLayer v-for="(layer, index) in layers" :key="index"
:type="layer.paintType"
:sourceId="`source${index}`"
:layerId="`layer${index}`"
:source.sync="layer"
:paint="layer.paint"
/>layers: function() {
let layers = [];
this.bufferLayer ? layers.push(this.bufferLayer) : null;
this.insideLayer ? layers.push(this.insideLayer) : null;
this.outsideLayer ? layers.push(this.outsideLayer): null;
return layers;
},Example layer:
const layer1 = {
"paintType": "line",
"paint": {
"line-color": "cyan",
"line-opacity": 0.5
},
"type": "FeatureCollection",
"features": [ ...]
}
However, when swapping out a layer at position i, the paint properties are not re-evaluated, but rather, the paint properties of the previous layer at i are kept.