我正在使用Mapbox在地图点击时放置一个标记。我成功地获得了坐标,但是我不能将它们绑定到我的数据上。
         map.on('click', function(e) {
            if (this.marker) { this.marker.remove() }
            this.marker = new mapboxgl.Marker()
            .setLngLat({ lng: e.lngLat.lng, lat: e.lngLat.lat})
            .addTo(map);
            map.flyTo({
                center: { lng: e.lngLat.lng, lat: e.lngLat.lat },
                zoom: 15
            });
            // This does not bind and update the data
            this.latitude = JSON.stringify(e.lngLat.lat)
            this.longitude = JSON.stringify(e.lngLat.lng)
        })https://stackoverflow.com/questions/52998816
复制相似问题