console
new Yox({
el: '#app',
template: '#template',
data: {
level: 1,
name: '1',
children: [
{
level: 2,
name: '1',
children: [
{
level: 3,
name: '1',
}
]
},
{
level: 2,
name: '2',
children: [
{
level: 3,
name: '1',
}
]
}
]
},
methods: {
print: function (keypath) {
console.log(keypath)
}
}
})
<div id="app"></div>
<script id="template" type="text/plain">
<div>
{{#partial node}}
<p>
level: {{this.level}}<br>
name: {{this.name}}<br>
<button on-click="print($keypath)">
print
</button>
{{#each this.children}}
{{> node}}
{{/each}}
</p>
{{/partial}}
{{> node}}
</div>
</script>