我正在尝试从this.card
复制constructor
。但是,到目前为止,它不起作用。也许这是不可能的。无论如何,有人可以告诉我该怎么做吗?
class CardList {
constructor(card) {
this.card = card;
}
render(container, cards) {
this.container = container;
this.cards = cards;
this.cards.forEach(card => {
this.card.placeImage.setAttribute(
"style",
`background-image: url(${card.link})`
);
this.card.placeName.textContent = card.name;
this.container.appendChild(this.card.placeCard);
});
}
}