Slide 21
Slide 21 text
͔Βࢠͷ௨৴%0.ͷमਖ਼ͷํ๏
!21
const prices = { t_porsche: '66,00 €', t_eicher: '58,00 €’, … };
class BlueBuy extends HTMLElement {
static get observedAttributes() {
return ['sku'];
}
constructor() {
super();
this.render();
}
render() {
const sku = this.getAttribute('sku');
const price = prices[sku];
this.innerHTML = `buy for ${price}`;
}
attributeChangedCallback(attr, oldValue, newValue) {
this.render();
}
disconnectedCallback() {...}
}
window.customElements.define('blue-buy', BlueBuy);