arcgis for js 4.23.7 版本 , 新增一个graphic之后 , 无法通过remove方法删除 , 是何原因 ?

mounted () {
layer = new GraphicsLayer({
id: this.layerId
})
this.drawPoint(this.attributeTemp.longitude, this.attributeTemp.latitude)
}
}
drawPoint (x, y) {
const point = {
type: 'point',
longitude: x,
latitude: y
}

const markerSymbol = {
type: 'simple-marker',
color: [226, 119, 40]
}
pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
})
layer.add(pointGraphic)
this.mapTemp.add(layer)
}
beforeDestroy () {
if (layer) {
layer.removeAll()
this.mapTemp.remove(layer)
layer = null
}
}
通过这种方式无法删除绘制点 , 唯一的删除方式是 , view.graphics.add(graphic) , 然后通过view.graphics.removeAll() , 这是个啥子原因
已邀请:

yhl1015951447 - 111111111111111111

赞同来自:

layer是不是没有取到

要回复问题请先登录注册