Added functions to delete custom markers

This commit is contained in:
Alexis
2024-01-13 14:53:37 +01:00
parent 244bd06f37
commit 3abf35ee58
2 changed files with 49 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ const allMarkers = computed(() => {
})
// Search functions
const searchBar = ref<HTMLDivElement>()
const qInput = ref()
const { focused: isFocused } = useFocus(qInput)
@@ -179,6 +180,15 @@ onMounted(() => {
customMarkersData.value = useLocalStorage('custom-markers', []).value
})
})
/**
* Emit event to delete custom marker
*/
function emitDeleteCustomMarker(markerTitle: string) {
const deleteCMarkerEvent = new CustomEvent(`delete-${markerTitle}`, { bubbles: true })
searchBar.value?.dispatchEvent(deleteCMarkerEvent)
}
</script>
<template>
@@ -222,7 +232,7 @@ onMounted(() => {
<i class="ph-light ph-pencil-simple-line"></i>
</button> -->
<button class="btn btn-danger btn-icon btn-sm">
<button class="btn btn-danger btn-icon btn-sm" @click="emitDeleteCustomMarker(m.title)">
<i class="ph-light ph-trash"></i>
</button>
</div>