我的应用程序使用了onsen用户界面。
<ons-tabbar position="top" animation="fade" id="tabsLayout">
</ons-tabbar>是否可以使用javascript添加选项卡项?
发布于 2015-03-18 12:39:34
是的,效果很好。只需用类名"tab-bar“将其附加到元素中,不要忘记在元素上运行ons.compile():
var $tab = $('<ons-tab page="home.html" label="Label" active="true"></ons-tab>');
$('.tab-bar').append($tab);
ons.compile($tab[0]);我使用jQuery使创建元素更加容易。当然,如果不使用document.createElement()和el.appendChild(),则可以使用jQuery。
https://stackoverflow.com/questions/29121593
复制相似问题