有的时候,我们没有用到popupTemplate 。这个时候,点击那个图层的时候,就没有高亮效果,要想点击高亮,就需要featureLayerView.
把这段代码加入到view的点击事件里面,就可以点击那个图层, 那个图层就高亮。
view.whenLayerView(graphic.layer).then(function(featureLayerView) {
if (_this.highlight) {
_this.highlight.remove()
}
_this.highlight = featureLayerView.highlight(graphic);
}
).catch(function(error) {
// An error occurred during the layerview creation
})