使用产品:icilent for leaflet
问题详细描述:L.control.sideBySide()控件无法切换左右卷帘图层
现有一个需求,通过事件监听select DOM的value值变化来确定左右卷帘图层,但编写后无法进行切换,想请教一下是什么原因
//监听select value切换事件
onSelectedChange(){
var leftLayer= this.layerActive.find((item) => item.name === this.$refs.leftSeleted.value);
var rightLayer= this.layerActive.find((item) => item.name === this.$refs.rightSeleted.value);
//通过value值获取激活图层列表中的左右图层
if(this.siderLayer!==null){this.map.removeControl(this.siderLayer) }
this.siderLayer = new L.control.sideBySide([],[]).addTo(this.map)
this.siderLayer.setLeftLayers(leftLayer)
this.siderLayer.setRightLayers(rightLayer)
this.siderLayer.addTo(this.map)
},