有的時候,我們沒有用到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
})