npm i mirlo --save-dev
- HTML:
<template id="template-mirlo-demo">
<span id="msg"></span>
</template>
<mirlo-demo id="demo"></mirlo-demo>
- JS 'Component':
import {Component, registerComponent} from 'mirlo';
export default class Demo extends Component {
onSetup() {
Component.useEvents({
msg: {
mode: 'id',
events: {
click: this.onClickMessage,
},
},
});
}
onStart() {
super.onStart();
this.queryId('msg').innerHTML = '<strong>Hello World!</strong>';
}
onClickMessage(ev) {
ev.target.innerHTML = '<strong>Clicked!</strong>';
}
}
registerComponent('demo', Demo);
- JS 'Main':
import './components/demo01';