riot bug
by gianlucaguarini
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/3.1.1/riot.min.js"></script>
<script type="tmpl" id="child_tmpl">
<button onclick={onclick}>Click Me {count}</button>
</script>
<script type="tmpl" id="parent_tmpl">
<div>
<child-tag ref="child"/>
</div>
</script>
<wrapper></wrapper>
JavaScript
riot.tag('child-tag', child_tmpl.innerHTML, function(opts){
this.count = 0
this.onclick = () =>{
this.count = this.count + 1
this.trigger('clicked')
}
})
riot.tag('wrapper', parent_tmpl.innerHTML, function(opts) {
this.on('mount', () => {
this.refs.child.on('clicked',() => {
this.update({ count: 100 })
})
})
})
riot.mount('wrapper', {});