Prettified
This commit is contained in:
parent
143c63bbf8
commit
6e334c91d3
1 changed files with 37 additions and 36 deletions
|
|
@ -250,16 +250,20 @@ export default {
|
||||||
// When the Street Address textbox receives focus,
|
// When the Street Address textbox receives focus,
|
||||||
// append the search results list container to the bottom of the textbox
|
// append the search results list container to the bottom of the textbox
|
||||||
// and disable browser autofill
|
// and disable browser autofill
|
||||||
this.addressField1.addEventListener("focus", (e) => {
|
this.addressField1.addEventListener(
|
||||||
// Make place results box stick to the input on scroll
|
"focus",
|
||||||
const streetAddressField = document.getElementById("streetAddressField");
|
(e) => {
|
||||||
const autocompleteResultsContainer =
|
// Make place results box stick to the input on scroll
|
||||||
document.getElementsByClassName("pac-container")[0];
|
const streetAddressField = document.getElementById("streetAddressField");
|
||||||
|
const autocompleteResultsContainer =
|
||||||
|
document.getElementsByClassName("pac-container")[0];
|
||||||
|
|
||||||
if (autocompleteResultsContainer) {
|
if (autocompleteResultsContainer) {
|
||||||
streetAddressField.appendChild(autocompleteResultsContainer);
|
streetAddressField.appendChild(autocompleteResultsContainer);
|
||||||
}
|
}
|
||||||
}, { once: true });
|
},
|
||||||
|
{ once: true }
|
||||||
|
);
|
||||||
|
|
||||||
this.addressField1.addEventListener("keydown", (e) => {
|
this.addressField1.addEventListener("keydown", (e) => {
|
||||||
// When the user presses a key in the Street Address field, immediately disable autocomplete for that field.
|
// When the user presses a key in the Street Address field, immediately disable autocomplete for that field.
|
||||||
|
|
@ -305,9 +309,6 @@ export default {
|
||||||
this.unloadAutocomplete();
|
this.unloadAutocomplete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
disableAutoFill() {
|
disableAutoFill() {
|
||||||
|
|
@ -454,36 +455,36 @@ export default {
|
||||||
|
|
||||||
// Temporary
|
// Temporary
|
||||||
const element = document.getElementsByClassName("address-questions")[0];
|
const element = document.getElementsByClassName("address-questions")[0];
|
||||||
element.addEventListener("change", (e) => {
|
element.addEventListener(
|
||||||
// console.log(`change event`);
|
"change",
|
||||||
// console.log(e);
|
(e) => {
|
||||||
|
// console.log(`change event`);
|
||||||
|
// console.log(e);
|
||||||
|
|
||||||
if (this.showAddressFields) {
|
if (this.showAddressFields) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let autoFilledInputs = [];
|
let autoFilledInputs = [];
|
||||||
autoFilledInputs = element.querySelectorAll("input:-webkit-autofill");
|
autoFilledInputs = element.querySelectorAll("input:-webkit-autofill");
|
||||||
|
|
||||||
|
|
||||||
console.log(this.addressModel.city);
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.showAddressFields = autoFilledInputs.length > 0;
|
|
||||||
console.log(this.addressModel.city);
|
console.log(this.addressModel.city);
|
||||||
console.log(document.getElementById("city").value)
|
this.$nextTick(() => {
|
||||||
})
|
this.showAddressFields = autoFilledInputs.length > 0;
|
||||||
console.log(this.addressModel.city);
|
console.log(this.addressModel.city);
|
||||||
console.log(document.getElementById("city").value)
|
console.log(document.getElementById("city").value);
|
||||||
|
});
|
||||||
|
console.log(this.addressModel.city);
|
||||||
|
console.log(document.getElementById("city").value);
|
||||||
|
|
||||||
|
if (this.showAddressFields) {
|
||||||
if (this.showAddressFields) {
|
this.unloadAutocomplete();
|
||||||
this.unloadAutocomplete();
|
}
|
||||||
|
|
||||||
|
this.addressField1.classList.remove("has-icon");
|
||||||
}
|
}
|
||||||
|
// { once: true }
|
||||||
this.addressField1.classList.remove("has-icon");
|
);
|
||||||
},
|
|
||||||
// { once: true }
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
beforeUpdate() {
|
beforeUpdate() {
|
||||||
// It is necessary to set focus on the street address on this lifecycle hook when this component is used in a modal.
|
// It is necessary to set focus on the street address on this lifecycle hook when this component is used in a modal.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue