implementado google fontes
This commit is contained in:
parent
33fe5d6ecf
commit
2afa99512e
11 changed files with 131 additions and 11 deletions
|
|
@ -2,6 +2,8 @@
|
|||
<v-container class="py-6">
|
||||
<h1 class="text-h5 mb-4">Playground — eli-vue</h1>
|
||||
|
||||
|
||||
|
||||
<v-tabs v-model="aba" color="primary" density="comfortable">
|
||||
<v-tab value="botao">Botão</v-tab>
|
||||
<v-tab value="indicador">Indicador</v-tab>
|
||||
|
|
@ -77,11 +79,34 @@ export default defineComponent({
|
|||
data() {
|
||||
return {
|
||||
aba: "botao" as AbaPlayground,
|
||||
fontVars: {
|
||||
eli: "",
|
||||
v: "",
|
||||
body: "",
|
||||
},
|
||||
googleSansCheck: "(checando...)" as string,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.sincronizarAbaComHash();
|
||||
window.addEventListener("hashchange", this.sincronizarAbaComHash);
|
||||
|
||||
// Coleta variáveis de fonte e confirma carregamento via FontFaceSet.
|
||||
this.fontVars.eli = getComputedStyle(document.documentElement).getPropertyValue("--eli-font-family").trim();
|
||||
this.fontVars.v = getComputedStyle(document.documentElement).getPropertyValue("--v-font-family").trim();
|
||||
this.fontVars.body = getComputedStyle(document.body).fontFamily;
|
||||
|
||||
// Espera fonts carregarem e então checa se o navegador considera Google Sans disponível
|
||||
// (isso não garante 100% que TODOS pesos/estilos foram baixados, mas confirma que a face existe/foi carregada)
|
||||
document.fonts.ready
|
||||
.then(() => {
|
||||
this.googleSansCheck = String(document.fonts.check('12px "Google Sans"'));
|
||||
// atualiza body depois do load, pois pode mudar após o font-face carregar
|
||||
this.fontVars.body = getComputedStyle(document.body).fontFamily;
|
||||
})
|
||||
.catch(() => {
|
||||
this.googleSansCheck = "erro";
|
||||
});
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener("hashchange", this.sincronizarAbaComHash);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue