0.0.3 • Published 9 months ago
@levinelito/base-component v0.0.3
Simple Base Class for Web Component
Usage
class MyInfo extends BaseComponent {
static observedAttributes = ['name', 'height'];
Attributes = {
name : {
required : true,
type : 'string'
},
height : { type : 'integer' }
}
_render() {
this.innerHTML = '<div>';
this.innerHTML += `My name is ${this.getValue('name')}.`;
this.innerHTML += `I'm ${this.getValue('height')} cm tall.`;
this.innerHTML += '</div>';
}
}
customElements.define('my-info', MyInfo);
<my-info name="Levine" height="170"></my-info>