Reset address when field is empty

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-04-16 18:12:57 +02:00
parent 57b1e53420
commit 6eb42660d5
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 10 additions and 2 deletions

View File

@ -22,7 +22,7 @@
expanded
@select="updateSelected"
>
<template slot-scope="{ option }">
<template #default="{ option }">
<b-icon :icon="option.poiInfos.poiIcon.icon" />
<b>{{ option.poiInfos.name }}</b
><br />
@ -31,7 +31,7 @@
<template slot="empty">
<span v-if="isFetching">{{ $t("Searching") }}</span>
<div v-else-if="queryText.length >= 3" class="is-enabled">
<span>{{ $t('No results for "{queryText}"') }}</span>
<span>{{ $t('No results for "{queryText}"', { queryText }) }}</span>
<span>{{
$t(
"You can try another search term or drag and drop the marker on the map",
@ -302,6 +302,14 @@ export default class FullAddressAutoComplete extends Vue {
});
}
@Watch("queryText")
resetAddressOnEmptyField(queryText: string): void {
if (queryText === "" && this.selected?.id) {
console.log("doing reset");
this.resetAddress();
}
}
resetAddress(): void {
this.$emit("input", null);
this.queryText = "";