feat: placeholder do cep pronto e funcionando

This commit is contained in:
Adilson Fernando Neves Ornellas 2023-01-28 17:03:56 -03:00
parent d0176b72ea
commit cbf2a7d744

View File

@ -1,15 +1,27 @@
import React from "react";
const PlaceholderCep = () => { const PlaceholderCep = () => {
new Promise(resolve => {
if (document.querySelectorAll(".vtex-address-form-4-x-input").length > 0) {
return resolve(Array.from(document.querySelectorAll(".vtex-address-form-4-x-input")));
}
if (typeof document !== "undefined") { const observer = new MutationObserver(() => {
if (document.querySelectorAll(".vtex-address-form-4-x-input").length > 0) {
resolve(document.querySelectorAll(".vtex-address-form-4-x-input"));
observer.disconnect();
}
});
// document.getElementsByClassName("vtex-address-form-4-x-hideDecorators")[0].setAttribute("placeholder", "Digite seu CEP"); observer.observe(document.body, {
childList: true,
subtree: true,
});
}).then((els: any) => {
els[0].placeholder = "Digite seu CEP";
});
// .placeholder = "Digite seu CEP" return <></>;
};
return "" ;
}; };
export default PlaceholderCep; export default PlaceholderCep;