99<script >
1010
1111import LayerLegend from ' ../../util/LayerLegend' ;
12+ import { LayerProxy } from ' ../../util/Layer'
1213
1314/**
1415 * Module for one legend element.
@@ -22,7 +23,8 @@ export default {
2223 data () {
2324 return {
2425 resolution: this .mapView .getResolution (),
25- viewResolutionChanged: undefined
26+ viewResolutionChanged: undefined ,
27+ layerProxy: new LayerProxy (this .layer , [' legend' , ' legendOptions' ])
2628 }
2729 },
2830
@@ -44,6 +46,7 @@ export default {
4446 if (this .viewResolutionChanged ) {
4547 this .mapView .un (' change:resolution' , this .viewResolutionChanged );
4648 }
49+ this .layerProxy .destroy ();
4750 },
4851 computed: {
4952 /**
@@ -52,10 +55,11 @@ export default {
5255 legendURL () {
5356 const options = {
5457 language: this .$i18n .locale ,
55- ... this .layer .get (' legendOptions' )
58+ ... this .layerProxy .get (' legendOptions' )
5659 };
5760 return LayerLegend .getUrl (
58- this .layer , this .resolution , options, this .layer .get (' legendUrl' ));
61+ this .layerProxy .getLayer (), this .resolution , options,
62+ this .layerProxy .get (' legendUrl' ));
5963 }
6064 }
6165}
0 commit comments