9
9
<script >
10
10
11
11
import LayerLegend from ' ../../util/LayerLegend' ;
12
+ import { LayerProxy } from ' ../../util/Layer'
12
13
13
14
/**
14
15
* Module for one legend element.
@@ -22,7 +23,8 @@ export default {
22
23
data () {
23
24
return {
24
25
resolution: this .mapView .getResolution (),
25
- viewResolutionChanged: undefined
26
+ viewResolutionChanged: undefined ,
27
+ layerProxy: new LayerProxy (this .layer , [' legend' , ' legendOptions' ])
26
28
}
27
29
},
28
30
@@ -44,6 +46,7 @@ export default {
44
46
if (this .viewResolutionChanged ) {
45
47
this .mapView .un (' change:resolution' , this .viewResolutionChanged );
46
48
}
49
+ this .layerProxy .destroy ();
47
50
},
48
51
computed: {
49
52
/**
@@ -52,10 +55,11 @@ export default {
52
55
legendURL () {
53
56
const options = {
54
57
language: this .$i18n .locale ,
55
- ... this .layer .get (' legendOptions' )
58
+ ... this .layerProxy .get (' legendOptions' )
56
59
};
57
60
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' ));
59
63
}
60
64
}
61
65
}
0 commit comments