gm2mars
Tue, 03 Feb 2015 14:25:43 GMT
---
riot.tag('select','<select id="select"><option each="{ data }">{ caption }</option></select>', function() {
this.data=[
{'caption': 'one'},
{'caption': 'two'},
{'caption': 'three'}
];
this.one('mount', function () {
console.log(document.getElementById('select_input').querySelectorAll(' option').length);
//4
//<option>{ caption }</option>
setTimeout(function() {
console.log(document.getElementById('select_input').querySelectorAll(' option').length);
//3
}, 100);
});
});
riot.mountTo(document.getElementById('select_box'), 'select');
---
p.s. Sorry for my english