Skip to content

Commit

Permalink
Corrige carregamento das imagens.
Browse files Browse the repository at this point in the history
  • Loading branch information
andremaravilha committed May 25, 2024
1 parent ba41411 commit d079fdc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dompurify": "^3.0.5",
"front-matter": "^4.0.2",
"hover.css": "^2.3.2",
"marked": "^5.1.1",
"marked": "^12.0.2",
"vue": "^3.2.47",
"vue-router": "^4.0.13"
},
Expand Down
9 changes: 4 additions & 5 deletions src/lib/hep-cartas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import DOMPurify from '~dompurify';


const ARQUIVOS = import.meta.glob(`@/assets/cards/*.md`, { as: 'raw', eager: true });
const URL_IMAGEM_INDEFINIDA = new URL(`@/assets/card-noimage.png`, import.meta.url).href;
const URL_IMAGENS = new URL(`@/assets/cards/imagens`, import.meta.url).href;
//const IMAGEM_INDEFINIDA = new URL('/src/assets/card-noimage.png', import.meta.url);

// Arrays que armazenam os dados das cartas
const CARTAS = [];
Expand All @@ -24,11 +23,11 @@ for (let key of Object.keys(ARQUIVOS)) {

// Define a URL da imagem da carta
if (carta.imagem) {
//let arquivo = `${carta.id}.png`;
let arquivo = carta.imagem.substring(0, carta.imagem.lastIndexOf('.')) + '.png';
carta.imagem = `${URL_IMAGENS}/${arquivo}`;
carta.imagem = new URL(`/src/assets/cards/imagens/${arquivo}`, import.meta.url);
} else {
carta.imagem = URL_IMAGEM_INDEFINIDA;
//carta.imagem = IMAGEM_INDEFINIDA;
carta.imagem = '';
}

// Adiciona a carta ao array de cartas
Expand Down
1 change: 0 additions & 1 deletion src/views/DecksView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export default {
},
mounted() {
this.modal.elemento = new bootstrap.Modal(document.querySelector('#modal-carta'));
console.log(this.cartas);
},
methods: {
exibirModal(id) {
Expand Down

0 comments on commit d079fdc

Please sign in to comment.