我不想使用默认的编辑工具栏,我想将其放在页面上的其他地方
mounted() {
this.$nextTick(() => {
const self = this;
this.map = this.$refs.map.mapObject;
this.drawnItems = new window.L.FeatureGroup();
this.map.addLayer(this.drawnItems);
this.drawControl = new window.L.Control.Draw({
position: 'topright',
draw: {
polyline: false,
polygon: false,
circle: false,
circlemarker: false,
marker: false,
zoomControl: true,
rectangle: false
},
edit: {
featureGroup: this.drawnItems,
remove: true
}
});
this.map.addControl(this.drawControl);
// create
this.map.on(window.L.Draw.Event.CREATED, e => {
let layer = e.layer;
this.drawnItems.addLayer(layer);
});
// edite
this.map.on(window.L.Draw.Event.EDITED, e => {
let layers = e.layers;
layers.eachLayer(layer => {
});
});
// delete
this.map.on(window.L.Draw.Event.DELETED, e => {
let layers = e.layers;
layers.eachLayer(layer => {
});
});
},
我希望地图上的图层无法编辑,因此只能在触发工具栏上的编辑按钮时进行编辑,该工具栏不在地图上,而是在页面上的其他位置。