Remove last & all marker buttons

This commit is contained in:
2021-09-05 22:08:02 +00:00
parent 218bea2aeb
commit 0c22a4127f
2 changed files with 10 additions and 6 deletions

2
dist/js/field.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -6,8 +6,11 @@
</field-map> </field-map>
<l-control position="bottomleft" > <l-control position="bottomleft" >
<button @click="clickHandler"> <button @click="removeLastMarker">
I am a useless button! Slett forrige
</button>
<button @click="removeAllMarkers">
Slett alle
</button> </button>
</l-control> </l-control>
</div> </div>
@@ -79,13 +82,14 @@ export default {
this.markers.splice(-1,1); this.markers.splice(-1,1);
this.triggerChange(); this.triggerChange();
}, },
removeAllMarkers() {
this.markers = [];
this.triggerChange();
},
createMarker(evt) { createMarker(evt) {
this.markers.push(evt.latlng); this.markers.push(evt.latlng);
this.triggerChange(); this.triggerChange();
}, },
clickHandler() {
alert('clicked');
},
}, },
components: { components: {