Olá, depois de tirar update da classe NegociacoesView para a View, percebi que a tabela simiu. Como faço para que ela reapareça?
import { Negociacoes } from "../models/negociacoes.js";
import { View } from "./view.js";
export class NegociacoesView extends View<Negociacoes> {
// private elemento: HTMLElement;
// constructor(seletor: string) {
// this.elemento = document.querySelector(seletor);
// }
template(model: Negociacoes): string {
return `
<table class="table table-hovered table-bordered">
<thead>
<tr>
<th>DATA</th>
<th>QUANTIDADE</th>
<th>VALOR</th>
</tr>
</thead>
<tbody>
${model.lista().map(negociacao => {
return `
<tr>
<td>${new Intl.DateTimeFormat().format(negociacao.data)}</td>
<td>${negociacao.quantidade}</td>
<td>${negociacao.valor}</td>
</tr>
`;
}).join('')}
</tbody>
</table>
`;
}
}
export class View<T> {
protected elemento: HTMLElement;
constructor(seletor: string) {
this.elemento = document.querySelector(seletor);
}
update(model: T): void {
const template = this.template(model);
this.elemento.innerHTML = template;
}
template(model: T): string {
throw Error('Classe filha precisa implementar o método template');
}
}