原代码:
let wms_forbidden_area = new ({
map:map,
url: wms_server + '/geoserver/ucloud/wms',
blend: false,
tileSize: 512,
zIndex:20,
params: {LAYERS: ['ucloud:forbidden_area'], VERSION: '1.1.1'}
});
当页面第一次加载的时候图层正确显示,但是当页面被刷新之后,图层就会消失
解决:
let wms_forbidden_area = new ({
url: wms_server + '/geoserver/ucloud/wms',
blend: false,
tileSize: 512,
zIndex:20,
params: {LAYERS: ['ucloud:forbidden_area'], VERSION: '1.1.1'}
});
wms_forbidden_area.setMap(map);
wms_forbidden_area.show();
换成上面的写法就不会出现这样的问题,估计是因为缓存的问题,图层存在于缓存,但需要设置map属性